Syntax Highlighter
Paste code and get back self-contained, inline-styled HTML (no external CSS) — or ANSI terminal colors. 100+ languages and many themes, powered by syntect. Runs in your browser; nothing is uploaded.
About this tool
The syntax highlighter turns a plain code snippet into colored, styled output you can paste straight into a web page, an email, a blog post, or a terminal. Pick the language and a color theme, choose HTML or ANSI, and copy the result. Everything runs locally in your browser with WebAssembly — your code is never uploaded.
HTML output
The HTML format returns a self-contained <pre> block with inline style attributes on
every colored token, plus a background color from the theme. Because the colors are inlined,
there is no external stylesheet to ship — it renders the same in a CMS, an email client, a
static site, or a sandboxed iframe. Just paste the markup where you need it.
ANSI output
The ANSI format emits 24-bit ("true color") terminal escape codes and ends with a reset.
Pipe or echo it into a terminal that supports true color to see the highlighted snippet, or
embed it in CLI help text and demo scripts.
Languages and themes
Highlighting is powered by syntect with its bundled
Sublime-Text syntax definitions, covering 100+ languages — use a hint like rust, python,
javascript, typescript, bash, json, yaml, go, c, cpp, html, or markdown.
An unknown or omitted language falls back to uncolored plain text. Themes include
base16-ocean.dark (the default), base16-ocean.light, Solarized (dark),
Solarized (light), base16-eighties.dark, base16-mocha.dark, and InspiredGitHub; an
unknown theme falls back to the default.
Privacy
This tool is pure client-side WebAssembly. Your code and the highlighted output stay in your browser — nothing is sent to a server.
FAQ
Why did my code come out uncolored?
The language hint didn't resolve. Resolution tries friendly aliases
(rust/rs, c++/cpp, bash/sh, …), then file-extension, token and
full syntax names, case-insensitively — and anything still unknown falls back
to plain text rather than erroring. Try the language's usual file extension
(ts, go, yaml) if the full name didn't take.
Is there a size limit on the snippet?
Yes — 512 KiB of source. Larger input is rejected with an explicit "too large" error (and empty input errors too) so a runaway paste can't hang the highlighter. For a whole file that big, split it into sections.
Do I need to add a stylesheet for the HTML output?
No. Every colored token carries an inline style attribute and the <pre>
gets the theme's background color, so the block is fully self-contained — it
renders identically in a CMS, an email client, or a sandboxed iframe with no
external CSS.
My terminal shows garbage instead of colors for ANSI output — why?
The ANSI format uses 24-bit "true color" escape sequences. Older terminals
(or multiplexer configs) that only support 256 colors won't interpret them —
check that your terminal advertises truecolor support (e.g.
COLORTERM=truecolor). The output ends with a reset code so it won't bleed
styling into your prompt.
Developer & Automation Access
Run it from the terminal
Same engine as this page, headless — via the gizza CLI:
gizza tool syntax-highlighter 'fn main() {
println!("Hello, world!");
}'New to the CLI? Get gizza →
Open it by URL
Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:
https://gizza.ai/tools/syntax-highlighter/?code=fn%20main%28%29%20%7B%0A%20%20%20%20println%21%28%22Hello%2C%20world%21%22%29%3B%0A%7D&language=rust&theme=base16-ocean.dark&format=htmlMachine-readable descriptor: tool.json — title + parameters JSON Schema for agents.
