How to Turn Code into an Image
To turn code into an image, paste it in the box above, pick a theme and press Copy image. The picture is ready to paste in a post, a slide or a chat straight away.
- Paste your code. Keep it short: 5 to 30 lines read best. Auto-detect picks the language; if it guesses wrong, choose it from the list.
- Choose the look. A theme for the code, a background around it, the font and size, and whether you want a window frame, a title or line numbers.
- Pick the scale. 2x is right for most places; use 3x for slides and print.
- Copy or share. Copy image puts a PNG on your clipboard; Publish & get a link uploads it and gives you a URL; Copy SVG code gives a vector version for docs and design tools.
Themes, Fonts and Backgrounds
Every theme below is the real thing: the same three lines, highlighted by the same engine the tool uses, so what you see here is what your image will look like. Dark themes stand out in social feeds; light themes suit documents, white slides and print. Press Use this theme to switch the tool above.
GitHub Dark Dark
The look of GitHub itself: calm contrast that suits social posts and READMEs.
GitHub Light Light
Clean and familiar for docs, wikis, white slides and printed handouts.
One Dark Pro Dark
Atom's classic palette, a long-time favourite in VS Code.
Dracula Dark
Purples, pinks and greens with high contrast that stand out in a busy feed.
Nord Dark
Cool, muted arctic blues for a quiet, polished look.
Monokai Dark
Bold, warm colours made famous by Sublime Text.
Solarized Dark Dark
Low-glare colours designed for long reading sessions.
Solarized Light Light
A soft cream background that is easy on the eyes on slides and paper.
Fonts made for code
A good coding font keeps similar characters apart (0 and O, 1, l and I) and lines up every column. Each sample below is drawn in the font itself.
- 0O 1lI {}=> != ===
JetBrains Mono Default
Taller lowercase letters for easy reading at small sizes, from the makers of IntelliJ, with ligatures for =>, != and ===.
- 0O 1lI {}=> != ===
Fira Code Classic
The font that made code ligatures popular: slightly wider and rounder, a favourite in talks and tutorials.
- 0O 1lI {}=> != ===
System monospace No download
The device's own code font (Menlo on a Mac, Consolas on Windows), without ligatures, so => stays two characters.
JetBrains Mono and Fira Code are free under the SIL Open Font License and load from our own server. Tip: 15 px is right for posts, 17-20 px for slides.
Backgrounds
The background is the frame around the code window. A gradient makes a post eye-catching; Transparent lets the window sit on any slide or page.
Where to Use Code Images
| Where | Good settings | Why an image |
|---|---|---|
| X, LinkedIn, Mastodon | Dark theme, gradient, 2x | Code blocks are not supported; the picture keeps colours and indentation |
| Slides and talks | 3x, 17-20 px font | Readable from the back of the room, no editor needed |
| Blog posts and newsletters | Theme of your site, transparent background | Looks the same in every email client |
| Chats, issues and forums | Any theme, Publish & get a link | One link instead of an attachment |
Tips for Readable Code Screenshots
- Show only what matters. Cut imports and boilerplate; a short snippet is easier to read in a feed.
- Keep lines under about 80 characters. Long lines make a wide image that gets tiny on phones.
- Add line numbers when you talk about lines ("see line 4"); leave them off for a cleaner look.
- Give the code as text too. Screen readers can't read a picture and nobody can copy from it: add a gist, a repository link or the snippet in the post text.
- Check for secrets. API keys, tokens and passwords in a screenshot are just as leaked as in text. To hide parts of an existing screenshot, use Blur Image.
Need to share a screenshot of your screen instead? Paste it and get a link in one step, or turn any picture into a link with Image to URL.