Code to Highlighted HTML and Image
Make code look good anywhere: highlighted HTML with inline styles for blogs and email, or a crisp SVG or PNG image with a window frame for slides and social media.
Runs in your browser. Your files never leave your device. See how to check
…
How to do it
- 1Paste code
Paste the snippet.
- 2Choose the language
Pick it from the list.
- 3Pick a theme
Dark, light, Monokai or Solarized.
- 4Set details
Font size, line numbers and window title.
- 5Copy HTML
For blogs, docs and email.
- 6Download the image
SVG or PNG for slides and posts.
About this tool
Code is easier to read with colour, but many places where you want to share it, such as blog editors, email newsletters, documentation tools, slide decks and social posts, either strip stylesheets or accept only images. This highlighter produces both. The HTML output uses inline styles only, so the colours survive in editors and email clients that remove CSS. The image output is an SVG with a rounded window frame, an optional title and line numbers, which stays sharp at any size and can be downloaded as a PNG for platforms that need a bitmap. The tokenizer understands keywords, strings, comments, numbers, function calls and type names for 26 languages, including JavaScript, TypeScript, Python, Java, C, C#, Go, Rust, PHP, Ruby, Kotlin, Swift, SQL, shell, CSS, HTML, JSON and YAML. Choose GitHub dark, GitHub light, Monokai or Solarized, the font size and whether to show line numbers.
HTML output
A single pre element with inline colours, ready to paste into a blog post, wiki, newsletter or slide tool that accepts HTML. It uses a monospace font stack available on every system and keeps your tabs as four spaces.
Image output
An SVG with the code drawn as text in the chosen theme, a window frame with the three familiar dots and an optional file name. Download it as SVG for presentations and documentation, where it stays sharp when scaled, or as PNG at double resolution for social media.
Themes
- GitHub dark and light: familiar and high contrast. - Monokai: popular for screenshots and talks. - Solarized light: soft colours for printed material.
Readability tips
Keep snippets short, ideally under 25 lines, with the important part highlighted by context rather than by size. Use 14 to 16 pixel text for slides and 12 to 14 for documentation. Light themes print better; dark themes stand out on social media.
Accessibility
Images of code cannot be read by screen readers or copied. When you post an image, also share the code as text or a link, and add alt text describing what the code does.
Choosing between HTML and image
Use HTML wherever readers might want to copy the code, such as blogs and documentation. Use the image for slides, social posts and places that strip formatting, and link to the source.
Fonts
The image uses the system monospace font of the viewer's device for SVG, so it may look slightly different on Windows and macOS; the PNG fixes the look at download time.
Limits
The highlighter uses keyword and pattern rules, not a full parser, so unusual syntax may be coloured imperfectly. Very long lines make wide images. It is a presentation aid; for documentation sites, a build-time highlighter is better.
Worked example
A TypeScript function that fetches a user becomes a GitHub-dark SVG titled app.ts with line numbers, keywords in red, strings in blue and the comment in grey italics, downloaded as a 2x PNG for a conference slide.
Quick facts
- Category: Developer & Data
- Works in your browser, no sign-up, no upload.
- Your input stays on your device.
- Available in English.
- Content last reviewed:
- Official source: Common syntax-highlighting conventions (GitHub, Monokai and Solarized colour schemes)
Frequently asked questions
Which languages are supported?
Twenty-six, including JavaScript, TypeScript, Python, Java, Go, Rust, SQL, shell, HTML and CSS.
Will the HTML keep its colours in my blog editor?
Usually yes, because it uses inline styles only.
Can I get a PNG?
Yes. Download the image as PNG at double resolution.
Can I hide line numbers?
Yes. Untick line numbers.
Is my code uploaded?
No. Highlighting happens in your browser.
Is an image of code accessible?
Not on its own; share the code as text too and add alt text.
