Skip to content

webview

A small C/C++ library that shows HTML-based user interfaces in a native window.

Stars
14.3k
Forks
1.1k
Licence
MIT
Language
C++
Last update
15 days ago
Type
Library

What it is

webview is a small C/C++ library that opens a native window containing a web view, so you can build a graphical app using HTML for the interface. It uses WebKit on Linux and macOS and Microsoft's WebView2 on Windows. It also supports two-way JavaScript bindings, so C/C++ code can call JavaScript and JavaScript can call C/C++.

  • Wrap an existing HTML/JavaScript front end in a native desktop window
  • Call C/C++ functions from JavaScript buttons and forms and update the page from C/C++
  • Build a small cross-platform GUI tool with one C++ codebase
  • Embed a web-based settings or setup screen inside a native application

Great for

  • C or C++ developers who want an HTML-based GUI without bundling a full browser framework
  • Developers building small desktop tools that need a simple window and web content
  • Projects that want a single-header or amalgamated library that is easy to drop in
  • Developers who need a C API that other languages can bind to

Not ideal for

  • People who want a ready-made app rather than a library to build one (it is code you compile into your own program)
  • Projects that need one identical rendering engine on every platform, since it relies on each system's web engine
  • Beginners with no C or C++ experience, since setup involves compilers, CMake and system libraries
  • Windows users targeting versions before Windows 11 without shipping the WebView2 runtime, which the README says must be installed
Step-by-step guide: how to use webviewInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Clone and build from source

    You'll need: C++11 compiler (C++14 on Windows) · CMake and Ninja (recommended, not required) · GTK and WebKitGTK development packages on Linux · WebView2 runtime on Windows before Windows 11

    Clone the repository

    git clone https://github.com/webview/webview

    Configure the example build

    cmake -G Ninja -B build -S . -D CMAKE_BUILD_TYPE=Release

    Build the project

    cmake --build build
  2. 2

    Run it

    • Install the GTK and WebKitGTK development packages for your platform, or the WebView2 runtime on Windows
    • Create a new directory with the CMakeLists.txt and main.cc files from the C++ example in the README
    • Run the cmake configure and build commands
    • Find the executable in the build/bin directory and run it
  3. 3

    Get the most out of it

    • Use the C++ or C APIs with the webview::core, webview::core_shared or webview::core_static CMake targets, depending on your language
    • Use two-way JavaScript bindings to let page buttons call C/C++ functions
    • Build the amalgamated header with amalgamate.py for a single-file drop-in
    • Use the examples folder referenced in the README for working code

Downloads

Strengths

  • Small footprint: the README describes it as a tiny library that wraps existing system web engines
  • Covers Linux (GTK with WebKitGTK), macOS (Cocoa with WebKit) and Windows (WebView2)
  • Offers both C++ and C interfaces, plus an amalgamated single-file build

Trade-offs

  • Rendering and available web features depend on each platform's WebKit or WebView2 version, so behavior can differ between systems
  • Linux setup requires installing GTK and WebKitGTK packages, and the right package set varies by distribution
  • No latest release is listed in the metadata, so you will likely need to pin a git tag such as 0.12.0 as the README example does

How it compares

ProjectStarsTypeLevelUpdatedBest for
webview (this)14.3kLibraryintermediate15 days agoC or C++ developers who want an HTML-based GUI without bundling a full browser framework
electron124kFrameworkintermediate4 days agoWeb developers who want to ship a desktop app using skills they already have
AriaNg13.3kAppbeginner1 months agoPeople who already run aria2 and want a visual control panel in a browser
lvgl25.1kLibraryintermediate4 days agoEngineers adding a touchscreen or display UI to an embedded device
DearPyGui15.7kLibrarybeginner18 days agoPython developers who want a desktop GUI for a script or internal tool
imgui76.9kLibraryintermediate6 days agoGame developers who want an in-engine debug or tools panel

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.