Carbon — Code to Image Generator
Paste code, pick a syntax theme, background and window style, then export the snippet as a PNG, JPG or SVG image at 1x to 4x.
Still loading. If the tool doesn’t appear, reload this page.
About this tool
Carbon — Code to Image Generator
Create and export high-resolution code snippet images with CodeMirror 6 syntax highlighting, 17 language modes, ten themes, gradients, window controls, Gist import, and PNG, JPG, or SVG export.
Turn a block of source code into a clean image you can drop into a blog post, slide deck, README or social post. The editor runs CodeMirror 6 with syntax highlighting for JavaScript, TypeScript, Python, Java, C and C++, Go, Rust, PHP, SQL, HTML, CSS, JSON, Markdown, XML and YAML, and the preview beside it is the exact node that gets exported, so what you see is what you download. Style the window frame, background, font and spacing, then save the result as a PNG, JPG or SVG. Requests that carry your input go to api.github.com.
How to use Carbon — Code to Image Generator
- 1
Paste your code into the editor, drop a code file onto it, import a file, or load a public GitHub Gist by URL. The language is detected automatically, or choose one from the language list.
- 2
Open the Style tab to pick one of ten syntax themes, a solid, gradient, image or transparent background, the font, size, line height, padding, corner radius, shadow, window controls and optional line numbers or watermark.
- 3
Choose PNG, JPG or SVG and a 1x to 4x scale, then download the image or copy it to your clipboard. Save a snippet to reuse it later in this browser.
Why use Carbon — Code to Image Generator
The preview is the export
The image you download is rendered from the same element you see in the preview, with the same fonts, colours and spacing, so there is no separate export layout to check.
Ten themes and full control of the frame
Choose from dark and light syntax themes, four coding fonts plus a system monospace, three window control styles, gradient or custom backgrounds, padding, radius and shadow.
Snippets stay in your browser
Saved snippets and their style settings are kept in this browser's local storage, and exports are generated on your device. Only the optional Gist import contacts GitHub.
Common use cases
- Add a readable, themed code screenshot to a blog post, tutorial or documentation page instead of pasting plain text
- Prepare snippets for slides, conference talks or a social post with a gradient background, a window title and a watermark
- Share a public GitHub Gist as an image by importing it by URL, adjusting the theme, and exporting a high-resolution PNG or a scalable SVG
Frequently asked questions
Which export formats and sizes are available?
You can export PNG, JPG or SVG at 1x, 2x, 3x or 4x scale, and copy a PNG to the clipboard in browsers that allow image copying. SVG output stays sharp at any size.
Does my code get uploaded anywhere?
No. Highlighting and image rendering happen in your browser. The only network request is the optional Gist import, which asks GitHub's public API for the gist you named. Imported text then stays in the editor.
Why does the Gist import say the rate limit was reached?
The import calls GitHub's public API without signing in, and GitHub limits how many such requests a visitor can make per hour. The message tells you roughly how long to wait, or you can paste the code into the editor instead. Secret gists cannot be imported.
Can I use a transparent or image background?
Yes. Pick Transparent for a PNG or SVG with no backdrop, or upload an image up to 10 MB as the backdrop. JPG has no transparency, so it is exported on a solid fill.
Where are saved snippets stored?
In local storage in your browser, together with the theme and style settings you used. Clearing site data removes them, and they are not synced to other devices.