Skip to content
Jellykit

Code to Image

Turn a code snippet into a syntax-highlighted image in a styled window on a gradient, and save it as PNG, JPEG, WebP or SVG.

  • Runs on your device
Loading tool

About Code to Image

Paste a snippet, pick its language and a theme, and get a clean picture of your code for slides, documentation, social posts or a pull request description. Choose a background, padding and font size, add a window frame with a file name, and turn on line numbers if they help.

Twenty languages are highlighted, from TypeScript and Python to SQL, YAML and shell scripts. The image is drawn in your browser at up to three times its size for sharp results, and the SVG export keeps the text selectable. Your code is not uploaded or kept in the page address.

How it works

  1. The code is highlighted with highlight.js. Only the grammar for the language you pick is downloaded, the first time you pick it.
  2. Tabs become spaces at the tab width you choose, and the window grows to fit the longest line. Snippets are limited to 400 lines of 240 characters.
  3. The picture is drawn on a canvas with your system’s monospace font, at one, two or three times its size. Very large images are refused rather than drawn blank, which some browsers would do.
  4. The SVG export holds real text with the same colors and layout, so it stays sharp at any size and can be edited later.

Questions

Why does the font look different on another computer?

The image uses the monospace font your system provides (SF Mono on a Mac, Consolas on Windows, and so on). The PNG keeps the look you saw; an SVG opened elsewhere uses that computer’s font.

Can I export WebP in Safari?

Safari cannot write WebP images from a canvas, so the tool tells you and you can choose PNG or JPEG instead. PNG is the best choice for code because it keeps text crisp.

Does it detect the language automatically?

No. Pick the language from the list; guessing from a short snippet is often wrong. Plain text draws the code in a single color.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.