Skip to content

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.

Theme
Background

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.

SizePixelsRatioUse it for
Open Graph (link previews)1200 × 6301.91 : 1The og:image of a blog post or docs page; shown when the link is shared on most social sites and chat apps.
X post1600 × 90016 : 9A single image in a post on X; 16:9 shows in the timeline without cropping.
Square1080 × 10801 : 1A square Instagram feed post.
Portrait1080 × 13504 : 5A 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.

  • Changelog list (changelog-01)01

    Changelog 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
  • Post grid (posts-01)02

    Post 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.

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
The About page template from UI Pro, built from its blocks.

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