01 / Social
Posts and threads
Colours and a frame stand out in a feed where plain code is hard to read.
Free tool
Paste code and get a clean picture of it for a post, a slide, docs or a tutorial: syntax colours, a window with the three dots, a gradient behind it and line numbers if you want them. The language is guessed for you. Highlight the lines that matter, wrap long lines, start the numbers at any line, fit it to a 16:9, square or upright post, and download a sharp PNG up to 4x or an SVG that stays crisp at any size. Long files work too: the preview scrolls. Copy it into a chat, or copy a link that opens the same picture.
Need a custom tool, app or website? Contact us →Background
Your code is drawn in your browser. It is never uploaded.
Why a picture
01 / Social
Colours and a frame stand out in a feed where plain code is hard to read.
02 / Slides
Large, sharp text on a background that matches your slides.
03 / Docs
A tidy picture of a snippet next to a video walkthrough of it.
Guide
A code to image tool draws your code as a picture, with syntax colours, a window frame and a background, so it reads well in a post, a slide or a tutorial. Here you paste the code, the language is guessed, and the picture redraws as you type. You can save it as a PNG at up to four times the size, as an SVG with real text, or copy it and paste it straight into a chat or a doc.
| Setting | Options | When to change it |
|---|---|---|
| Theme | Night, Violet, Forest, Sand, Paper | Sand and Paper are light, for printed docs and slides with a light background |
| Window | Three dots, Plain bar, No bar | No bar gives the most room to the code in a small space |
| Text size | Small, Medium, Large | Large for slides and for phone screens |
| Space around | None, Small, Medium, Large | None crops to the window, with no background and no shadow |
| Picture size | 1×, 2×, 3×, 4× | 2× for most uses, 3× or 4× for big screens and print |
| Wrap long lines | Off, or at 60, 80, 100 or 120 characters | A longer line continues on the next row, indented, with no line number of its own. Off keeps every line whole, which can make a very wide picture |
| Font | Geist Mono, your system's code font, Courier | Your system's code font is SF Mono or Menlo on a Mac and Consolas on Windows |
| Shadow | Soft shadow, No shadow | No shadow for a flat look on a slide. There is never a shadow with Space around set to None |
| Start at line | Any number from 0 | For a snippet from the middle of a file, so the numbers match your editor. Highlight lines uses these numbers too |
| Picture shape | Fit the code, 16:9, 1:1, 4:5 | Widens or heightens the background to that shape, with the window in the middle, so a post or slide does not crop it. Needs a background colour |
| Highlight lines | Line numbers like 3 or 2-4, 7 | Puts a band behind those lines and fades the rest, to point at the lines that matter |
| File name in the bar | Any text up to 60 characters | Also becomes the name of the downloaded file |
A long file name is cut short with an ellipsis so it never runs into the three dots. The file name is used for the download too, so typing greet.js saves a file called greet.js.png. Leave it empty and the file is called code.png.
Your code and every setting are kept in this browser, so the next picture starts where you left off. Copy link puts the code and settings into a link, after the # sign, which is never sent to a server. Whoever opens it sees the same picture and can download it. Anyone with the link can read the code, so keep private code out of links.
The height depends on the number of lines, and the width on the longest line, so it helps to know how they add up. At Medium text each line is 24 pixels tall. The window adds 44 pixels for the bar and 28 at the bottom, and Medium space adds 64 pixels on every side.
So a six-line snippet is 44 plus 144 plus 28, which makes a window 216 pixels tall. Add 128 for the space above and below and the picture is 344 pixels tall at 1×. At 2× it is 688 pixels tall, and at 3× it is 1032. The real size is shown when you save. A Picture shape other than Fit the code makes the background wider or taller to match.
One long line makes the whole picture wide, and a wide picture shrinks the text when a feed or a slide fits it to the screen. That is why Wrap long lines starts at 100 characters. The note under the code box shows the number of lines, how many rows were wrapped and the size the picture will be saved at.
Browsers cannot make a picture more than about 16,000 pixels on a side, or about 120 million pixels in all. When the code is long enough to pass that at the size you chose, the tool saves the biggest picture that works and says so on the status line, instead of failing. For a sharper picture of a long file, wrap the lines, use a smaller text size, or split the code into two pictures. While you edit, a long file scrolls inside the preview box at a size you can read.
Download SVG saves the code as real text in a vector file. It stays sharp at any zoom, has no size limit, and drops into slides, docs and design tools. With Geist Mono the font goes inside the file, so it looks the same everywhere. With the other two fonts, the viewer's own font of that kind is used.
The colouring is a light version of what a code editor does. It picks out keywords, text in quotes, numbers, comments, function names, types, and tags in HTML. A very short snippet can be guessed as the wrong language, and anything it does not recognise is treated as JavaScript. Pick the language yourself and the colours will follow. For config files, logs or plain output, choose Plain text so nothing is coloured by mistake.
If you want a picture of your whole editor instead, with the file tree and tabs, press Shift-Command-4, then the Space bar, and click the window. That saves a screenshot of just that window to your desktop. This tool is for when you only want the code, neatly framed.
If your snippet is JSON or SQL, tidy it first with the JSON formatter or the SQL formatter. For a picture that shows what changed between two versions, try the diff checker.
Questions
JavaScript and TypeScript, Python, HTML and XML, CSS, JSON, shell, SQL, C, C++, C# and Java, Go, Rust, Swift, PHP and Ruby. The colouring is simpler than a full code editor's, but keywords, text, numbers, comments, functions and tags are picked out.
Yes. Choose 2×, 3× or 4× and the picture is drawn at that many times the size you see, so text stays crisp on large and high density screens.
No, it is a picture. Put the code as text next to it when readers need to copy it, or they can use image to text.
Some browsers do not allow pages to put pictures on the clipboard. Use Download PNG instead.
No. It is drawn in this tab, so private code stays on your computer.
Click the last background swatch, the see-through one. The PNG then has only the window and its shadow, so it sits on any slide or page colour.
Yes. Pick Geist Mono, your system's own code font, or Courier under Font. All three are monospace, so the columns line up. You can change the text size too.
Yes. Click Download SVG. The code is saved as real text, so it stays sharp at any size and works in slides and design tools.
Paste the whole file. Long lines wrap at 100 characters, the preview scrolls, and the PNG is saved at the biggest size the browser allows. Download SVG has no size limit at all.
Yes. Tick Line numbers and type the first number under Start at line, for example 120 for a snippet from the middle of a file.
Choose 2× so the text stays sharp, and keep lines short so the picture does not get too wide. Large text with Medium space reads well on a phone.
Set Window to No bar. The code then starts at the top of the window, and the file name is not shown.