📸 Code Snippet to Image

Paste code, pick a language and a VS Code theme, tweak window chrome and padding, export as PNG. Highlighting is VS Code-grade via Shiki; nothing leaves your browser.

📝 Source
🪟 Window
🎨 Background
📐 Layout
Loading highlighter…
— × —

About Code Snippet to Image

Paste a snippet, pick a language and theme, and get a sharable PNG card — the same idea as Carbon, ray.so, or CodeImage, but entirely in your browser. Highlighting goes through Shiki, which uses the exact TextMate grammars and theme JSON files VS Code ships, so the result reads identically to what you see in your editor.

How to use

  1. Paste or type code in the editor — Tab inserts two spaces, like most code editors.
  2. Pick the matching Language and a Theme; the canvas re-renders live.
  3. Adjust Window chrome, Background (gradient, solid, or transparent), padding, and font size.
  4. Hit Copy PNG for the clipboard, or Download PNG to save a file.

Common use cases

  • Screenshots for blog posts, slides, or release notes where you want syntax-aware highlighting.
  • Twitter / X / Bluesky cards showing a short function or config block.
  • Mock-up code samples for docs that need to look consistent across pages.
  • Pairing a code card with a title card for a richer share image.

Tips

  • Keep snippets short — 30 lines or so. The card is most readable when each line is easy to scan at thumbnail size.
  • For dark social-card backgrounds, a Dracula / GitHub Dark theme reads better; for light cards, GitHub Light / Vitesse Light.
  • Switching the background to Transparent keeps the window chrome's shadow and exports a PNG with an alpha channel — drop it on any surface.
  • If your line wraps, drop the font size by one step or pick a wider preset.

FAQ

Does my code ever leave my browser?
No. Tokenization (via Shiki and a JavaScript regex engine), canvas layout, and PNG encoding all run locally. There's no upload, no server, no third-party API.
Why does my snippet look identical to VS Code?
We use Shiki, which uses the same TextMate grammars and theme JSON files that VS Code uses. The colors and tokenization match VS Code byte-for-byte.
Why does switching to a new language or theme briefly show a spinner?
Each grammar and theme is a separate file loaded on demand to keep the initial page small. Once loaded they're cached in memory for the rest of the session.
Why is my language not on the list?
We ship a curated set of grammars to keep the page light. Open an issue on GitHub and we'll add it.
Can I export with a transparent background?
Yes — pick Transparent under Background. The PNG is saved with an alpha channel so the card sits on whatever surface you drop it on.

More tools

JSON

Code

Ornaments

Image

Web / SEO

Generators

PDF