Skip to content
Tesserae

Keyboard shortcuts

Focus search
/
This help dialog
?
Run the current tool
Ctrl/⌘ +Enter
Copy the output (when an output is focused)
Ctrl/⌘ +C

Shortcuts are ignored while you are typing in an input, a textarea or a select.

Developer Utilities Beta

Code to Image

Paste code, pick a language and a colour theme, then export it as a clean PNG or SVG image — complete with a window chrome (traffic-light dots and a title bar), configurable padding, background and line height. Highlighting is done by Shiki, which runs in this tab and loads the grammar and highlighting engine from this site, so nothing leaves your device.

On-device No network Offline-ready

🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.

Try:

Preview
Zoom
Options

Choose a language so the snippet is highlighted correctly, or let the tool guess from the first lines.

The Shiki colour theme used to colour the tokens.

The file name shown in the title bar when window chrome is on.

Space (in px) between the code and the edge of the image.

The vertical space (in px) given to each line of code.

The size of the monospace code font.

The width of the code box in px. Lines longer than this are wrapped.

The image background. Use "theme" for the theme’s own background, or type any CSS colour such as #1e1e2e.

PNG is a raster bitmap; SVG is a sharp, scalable vector.

How it works

From a snippet to a shareable image

Paste code and the tool highlights it with Shiki and lays it out as a card, then hands back a self-contained SVG. The workbench shows that vector image on the spot, and the format option steers the download: SVG stays sharp at any size for slides and print, while PNG rasterises the same layout at 2× resolution for pasting anywhere that wants pixels. Alongside the image the stats report the detected language, the image dimensions and the number of code lines.

Language and theme choices

The language picker names every grammar bundled with this install, from bash and C through TypeScript, Rust and SQL, plus a plaintext fallback that needs no grammar. Choosing auto runs a small heuristic over the first lines of the snippet — a shebang names Python or Ruby, a quoted key brace suggests JSON, a leading <!DOCTYPE names HTML, a function signature with a type annotation suggests TypeScript — and anything it cannot place falls back to plain text. The theme select lists twelve Shiki palettes, from GitHub Dark and Dracula to Nord and Tokyo Night, and both the theme and the grammar are loaded lazily only when they are first used.

The chrome, the layout, the background

Window chrome is on by default and draws the macOS-style traffic-light dots with a title bar above the code, named by the title option; turn it off for a bare snippet. Padding, line height and font size are each set as a range in pixels and clamp to the listed bounds, and the width caps where long lines wrap. The background defaults to the theme’s own colour but can be overridden with any CSS colour such as #1e1e2e, so the card matches the page you will place it on.

Where the highlight runs

Shiki executes entirely in this tab. The highlighting core, the Oniguruma WebAssembly engine, the grammar and the theme for the language you pick are downloaded from this same origin on first use and cached, so a page that never highlights ships none of it and nothing you paste is sent to a server. The layout and SVG serialisation are pure and run straight after the token stream comes back, so the finished image is produced locally from your code.

Questions

Does the code leave my browser?

No. Shiki runs entirely in this tab. The highlight grammar and the highlighting engine are downloaded from this same site the first time you use them, and nothing is sent to any server.

Why did the first run take a moment?

The first highlight downloads and compiles the WebAssembly highlighting engine and the grammar for the language you picked. Later runs reuse what is already loaded, so they are instant.

What is the difference between PNG and SVG?

PNG is a bitmap — a fixed grid of pixels, good for sharing or pasting anywhere. SVG is a vector that stays sharp at any size, good for logos, slides and printing.

See category