Code to image
Paste your code, choose a theme, background and font, and download it as a PNG at 2× or 3×, as an SVG, or straight to your clipboard. Highlighting covers 8 languages, and four exact sizes fit link previews and social posts, from 1200 × 630 to 1080 × 1350.
PNG 0 × 0 px (2× of 0 × 0).
Export sizes
With Fit the code, the code window is as wide as your longest line (up to 1,400px) and the PNG comes out at 2× or 3× that. Pick a fixed size and the export is exactly that many pixels, with the window centred and scaled down if the code would not fit.
| Size | Pixels | Ratio | Use it for |
|---|---|---|---|
| Open Graph (link previews) | 1200 × 630 | 1.91 : 1 | The og:image of a blog post or docs page; shown when the link is shared on most social sites and chat apps. |
| X post | 1600 × 900 | 16 : 9 | A single image in a post on X; 16:9 shows in the timeline without cropping. |
| Square | 1080 × 1080 | 1 : 1 | A square Instagram feed post. |
| Portrait | 1080 × 1350 | 4 : 5 | A portrait Instagram feed post; longer snippets fit better than in a square. |
Docs and changelog blocks you can install now
3 of 50 free, no account. All of them in UI Pro.
01Changelog list
changelog-01 · Free. Four latest releases on a horizontal timeline with dates, versions and tags, earlier releases in a compact list below.
Open changelog-01
02Post grid
posts-01 · Free. A hospital newsroom: tinted header band, nine photo cards with tag and date in a 3×3 grid, and a load-more button.
Open posts-01- 03
All free blocks
Every one with a live preview, filtered to the ones you can use for free first.
See them all
Questions
How do I turn code into an image?
Paste the code above, pick a language (or leave it on Auto), a theme and a background, then press Download PNG. For a crisp image on retina screens keep the 2× export; 3× is for print and slides. Copy image puts the PNG on your clipboard, so you can paste it straight into Slack, Figma, Google Docs or a post on X.
What size should a code screenshot be for social media?
Use 1200 × 630 for a link preview image (Open Graph), 1600 × 900 (16:9) for a post on X, 1080 × 1080 for a square post and 1080 × 1350 for an Instagram portrait post. Pick the size under Size and the tool fits the code window inside it, scaling it down if the code is too long.
Should I export PNG or SVG?
PNG for social posts, chat and slides: it looks the same everywhere. SVG keeps the code as real text, so it stays sharp at any size and the code can be selected, but it loads its font from Google Fonts when opened and some apps (Slack, most social sites) do not accept SVG uploads.
Does my code leave the browser?
No. The image is drawn in your browser on a canvas. The link in the address bar holds your code, compressed, after the # sign, which browsers never send to a server. Geist Mono is served by themes.dev; the other four fonts load from Google Fonts when you pick them.
Which languages does it highlight?
TypeScript, JavaScript, CSS, HTML, JSON, Bash, Python, Rust, plus plain text. Auto picks one from what you paste. The highlighter is small and built in, not a full editor grammar, so unusual syntax can stay uncoloured; switch the language by hand if Auto guesses wrong.
Why does Copy image not work in my browser?
Copying an image needs the Clipboard API with ClipboardItem, which current Chrome, Edge and Safari support and Firefox only has in recent versions. Some browsers also block it in private windows. When it fails, the tool says so; Download PNG always works.
Is it free?
Yes. No sign-up, no watermark, and nothing to install.
More free tools
- SVG to PNG converterConvert SVG to PNG, JPG or WebP at 1× to 4× or an exact width, transparent or on a colour. Several files at once, one zip, and a warning when the SVG has no viewBox.
- Tailwind font size generatorBuild a font size scale on Tailwind names (text-xs to text-9xl) from a base size and ratio, with line heights, for v4 @theme or a v3 config.
- Open Graph checkerSee how a link renders on X, Facebook, LinkedIn, Slack, Discord, iMessage and Google, check og:image size and type, and copy fixed meta tags. Or paste HTML to check it in your browser.
- RGB to HEX converterConvert RGB to HEX and HEX to RGB both ways, with alpha (8-digit hex), rgba(), HSL and the closest Tailwind 4 color, or convert every color in a pasted list or stylesheet.
UI Pro
Build your next site from finished blocks
Every block, page template and website theme from €199, paid once, with every update and everything we add later. Not ready? The free blocks are open to everyone.
- blocks
- 1401
- page templates
- 55
- website themes
- 29

This card is a UI Pro block: Rooilijn (call-to-action-07).