Code to Image

Paste a snippet, pick the language and a theme, and download a clean PNG of your code in a window frame on a gradient background. It is made for slides, LinkedIn and X posts, blog headers and documentation, where a picture of code reads better than a phone-sized screenshot. Highlighting and drawing happen in your browser.

Background
Padding
Export size
Preview

Loading the highlighter...

The preview is scaled to fit. The PNG is exported at 2x for sharp text on slides and high-density screens.

Highlighting and drawing runs in your browser. What you type never leaves this device.

Features

  • Syntax highlighting for 23 languages, including JavaScript, TypeScript, Python, Java, Go, Rust, C++, PHP, SQL and Bash

  • 8 editor themes, from GitHub Dark and Dracula to GitHub Light

  • Gradient, solid white or transparent backgrounds, with four padding sizes

  • Optional window buttons, a file-name title and line numbers

  • Font size from 12 to 24 px, exported at 1x, 2x or 3x for crisp text

  • Shared indentation and blank edges trimmed automatically

Where code images work well

Slides and talks

Code pasted into slides loses its colours and wraps badly. A 3x PNG stays sharp on a projector and keeps the layout you chose.

LinkedIn and X posts

Posts do not support code formatting. An image of a short, focused snippet with a title is easier to read in the feed.

Docs, READMEs and blog posts

Use an image for a hero snippet or a before-and-after comparison, and keep the real code as text below it so readers can copy it.

Teaching material

Make consistent, readable code cards for worksheets, notes and course thumbnails.

Tips for a good code image

Keep it short

  • Aim for 5 to 20 lines and under about 70 characters per line, so the text stays large on a phone.
  • Remove imports and boilerplate that do not help the point you are making.
  • Add a file name as the title to give context, such as checkout.ts or views.py.

Sizes and formats

The image is as wide as your longest line, so the shape follows your code. Export at 2x for posts and documents, and 3x for slides and print. Choose Transparent to place the window on your own slide background; the PNG keeps the transparency.

Accessibility

Screen readers cannot read code in an image. When you post one, include the code as text or a link as well, and describe what it does in the alt text.

Code to Image - FAQ