Code to Image

Turn a code snippet into a shareable image with syntax highlighting — rendered entirely in your browser.

Preview

snippet.js
export async function fetchUser(id) {
  const response = await fetch(`/api/users/${id}`);

  if (!response.ok) {
    throw new Error(`Request failed: ${response.status}`);
  }

  return response.json();
}
  • Exported at 2× pixel ratio, so the result stays sharp on high-DPI screens and in slide decks.
  • Rendering happens in your browser via canvas — your code is never uploaded.
  • “Copy image” needs clipboard image support; Safari and older browsers may need Download instead.
  • Long lines are not wrapped, so the image grows sideways — shorten them before exporting if the result is too wide.

Your Data Never Leaves Your Device

Every tool runs entirely in your browser. Nothing you type is uploaded, stored, or logged on our servers.

100% Client-Side

Code to Image turns a snippet into a presentable picture — syntax highlighted, optionally framed in window chrome with a filename, on a gradient or transparent background. It is for the places code has to travel as an image rather than text: slide decks, social posts, documentation headers, and issue threads.

Export happens at twice the on-screen resolution so the result stays sharp when scaled up in a presentation or viewed on a high-DPI screen, and you can either download the PNG or copy it straight to the clipboard. Everything — highlighting and canvas rendering alike — happens locally in your browser, so proprietary code is safe to paste. One practical note: lines are deliberately not wrapped, since re-flowing code changes how it reads, so the image widens to fit the longest line.

FAQ

Download PNG saves a file, or Copy image puts it straight on your clipboard to paste into Slack, a doc, or a slide. Both render the preview exactly as shown.

Long lines are not wrapped, because wrapping code changes how it reads. The image grows to fit the longest line — break long lines in the snippet before exporting if the result is unwieldy.

Yes. It renders at twice the on-screen size, so it stays sharp on high-DPI displays and when scaled up in a presentation.

Writing images to the clipboard requires the async Clipboard API with image support, which some browsers restrict or omit. Download PNG works everywhere.

The grammars this site already loads — JavaScript, JSON, HTML, CSS, SCSS, Python, Go, Java, SQL, Bash, YAML, TOML, Markdown, and Clojure. Anything else can be rendered as plain text.

No. Highlighting and image rendering both happen locally in your browser, so it is safe to screenshot proprietary code.