Skip to content

Ghostty in the browser

ghostty-webgpu runs Ghostty’s unpatched libghostty-vt terminal emulator in WebAssembly and pairs it with a browser host and four renderers. Use it to embed interactive shells, build logs, or local command prompts without re-implementing VT parsing in JavaScript.

One native libghostty-vt instance owns escape parsing, active screen state, modes, scrollback, selection coordinates, and Unicode cell widths. Four renderers read from that single source of truth:

  • WebGPU and WebGL2 consume persistent cell and glyph buffers built in Zig (bridge.wasm) and upload only dirty byte ranges.
  • Canvas 2D paints frame one immediately while WebGPU or WebGL2 compiles its shaders in the background, then hands off in place without flashing. It also serves as the fallback when neither GPU API is available.
  • DOM renders plain styled rows when Canvas is unavailable or explicitly chosen through rendererFactory.

await terminal.open(host) measures the container synchronously before constructing the renderer, so terminal.appearance.grid and terminal.geometry() already hold the fitted column and row counts as soon as open() resolves.

Pick the package entry point that matches where your code runs:

Entry pointEnvironmentPurpose
ghostty-webgpuBrowserMain-thread Terminal host with automatic fitting, selection, links, scrollback, and Canvas-first GPU startup.
ghostty-webgpu/workerBrowserRuns libghostty-vt, Zig frame building, and WebGPU or WebGL2 rendering in a dedicated worker or TerminalWorkerPool on OffscreenCanvas.
ghostty-webgpu/coreBrowser or NodeHeadless GhosttyRuntime, GhosttyTerminal, and TerminalSession with no DOM or renderer imports.
ghostty-webgpu/hotkeysBrowserOptional Ghostty keymap adapter (attachTerminalHotkeys) backed by @shaulavo/hotkeys.
ghostty-webgpu/config-resolverNode or BunResolves host Ghostty config files into terminal appearance objects.

Shipped features include DEC mode 2026 synchronized output, mode 2027 grapheme clustering, opt-in GSUB ligatures (ligatures), lazy Unicode 13.0 BiDi (bidi), OSC 8 hyperlinks, URL detection, and an opt-in screen-reader text mirror (accessibility: {}).

Retained-buffer search, Sixel and Kitty image protocols, and a formal screen-reader audit remain open work. See status and limits and the changelog for release notes.