Skip to content

Code to Image — Beautiful Code Screenshots

Turn code into a beautiful image with syntax highlighting, gradient backgrounds and a macOS window. Download a 2× PNG or copy it. Free, no sign-up.

Lines: 15

Loading syntax highlighting…PNG · 2×

Background
Padding64px
Font size14px
Window

Drawn on a canvas in your browser. Your code is not uploaded.

How to use

  1. Paste your code. The language is detected automatically, or choose it from the menu.
  2. Pick a dark or light theme, a background and the padding, font size, window style and line numbers you like.
  3. Download a 2× PNG (Ctrl/⌘ + S) or copy the image straight to your clipboard.

Example

def greet(name: str) -> str:
    return f"Hello, {name}!"

print(greet("world"))

Details and limitations

Highlighting uses highlight.js, downloaded once from a public CDN (jsDelivr). The image is drawn on a canvas in your browser; your code is never uploaded.

The preview and the download are the same drawing, so the PNG matches what you see at twice the resolution. Up to 400 lines are rendered.

FAQ

Which languages are highlighted?

More than 25, including JavaScript, TypeScript, Python, Go, Rust, Java, Kotlin, Swift, C, C++, C#, PHP, Ruby, SQL, Bash, JSON, YAML, HTML, CSS and Markdown.

Why did Copy download the file instead?

Some browsers do not let websites put images on the clipboard. In that case the PNG is downloaded so you can paste or attach it yourself.

Can I get a transparent background?

Yes. Choose the checkered swatch: the margin around the window is exported as transparent pixels.

Format references

Tool page updated: