📸 Code Screenshot Generator
Create beautiful code screenshots with syntax highlighting, themes, and gradient backgrounds. Export as PNG or SVG. Runs entirely in your browser.
Last updated: November 8, 2026 · By the BoltQuickTools team
Turn a snippet into an image you can post
Social posts, slides and some documentation platforms will mangle or refuse a code block. An image of the code keeps its indentation and colours wherever it goes. This page draws one in a window frame on a gradient background.
Producing the image
- Paste into the Code box. Pressing Tab inserts two spaces.
- Set Language (16 options) and Theme (Monokai, Dracula, GitHub Dark, One Dark, Solarized Dark or Nord; all six are dark).
- Click a swatch under Background to pick one of ten gradients.
- Under Window, set Filename, Padding, Font Size and Radius, and toggle Window controls (macOS dots) and Line numbers.
- Click Export PNG or Export SVG.
What you get from the default snippet
The page opens with a small JavaScript function. In Monokai, function is coloured as a keyword (#f92672), greet as a function name (#a6e22e) because a ( follows it, and the // Say hello line as a comment (#75715e). Export PNG downloads app.js.png at twice the size the preview occupies on screen, and Export SVG downloads app.js.svg. The file name is the Filename field plus the extension, so app.js becomes a double-extension name. With the field empty, the file is called code.png or code.svg.
Where the output can differ from your editor
The highlighter is a simple character scanner, not a parser, so some code is coloured wrongly or drawn badly.
- Comments and strings spanning several lines flatten in exports. A
/* ... */block, a template literal or a Python docstring across lines is treated as one piece. The preview shows it under a single line number, and the PNG and SVG draw it all on one line. Rewrite it as single-line comments or split the string before exporting. //starts a comment in every language, including Python, wherea // bis floor division.#is a comment only for Python, Ruby, Bash and PHP.- A lone apostrophe opens a string. A Rust lifetime such as
&'a str, ordon'tin HTML text, colours everything as a string until the next apostrophe. - HTML comments are not recognised, so
<!-- x -->is coloured as operators and text. - Pasted tab characters shrink. Exports draw each tab as one space wide, while the preview does not. Convert indentation to spaces first.
- Long lines are not wrapped. The preview and both exports grow to fit the longest line, so one very long line gives a very wide image with code that looks tiny once it is scaled to fit a post. Break long lines before exporting.
- SVG does not embed fonts. Text is live and refers to Courier New, Consolas and generic monospace, with token positions calculated for a fixed character width. On a device with a different monospace font, spacing can look uneven. Use PNG if it must look the same everywhere.
Does my code get sent anywhere?
The preview and both exports are created by this page's JavaScript, and the tool's code does not transmit your snippet. The page does make other requests: it loads the Inter web font from Google Fonts, used for the filename label, the site's analytics script, and ad scripts if you accept them.
How do I get a larger PNG?
Increase Font Size and Padding. The export is always a fixed two times the on-screen size, so there is no separate resolution setting. Large exports can be shrunk afterwards with the image compressor.
Can I edit the SVG later?
Yes. Each token is a separate text element, so it opens as editable text in vector tools. To convert it to a bitmap at a chosen size, use the SVG converter. If what you want to show is a change rather than a snippet, the code diff viewer displays both versions.