Black Friday: 50% off every paid plan with code BF50. Ends 5 December.

See prices

Free tool

Code to image, ready to share.

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

Code people will actually read.

01 / Social

Posts and threads

Colours and a frame stand out in a feed where plain code is hard to read.

02 / Slides

Talks and lessons

Large, sharp text on a background that matches your slides.

03 / Docs

Tutorials and READMEs

A tidy picture of a snippet next to a video walkthrough of it.

Guide

How to turn code into an image, that people can read.

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.

How to make a code screenshot

  1. Paste your code into the box under the preview, replacing the sample. The Tab key adds two spaces.
  2. Check the note under the box, which says which language was guessed. If it is wrong, pick the right one under Language.
  3. Pick a background swatch, or the see-through one, and a Theme: Night, Violet, Forest, Sand or Paper.
  4. Set the Window, Text size and Space around. Type a File name in the bar if you want one, and tick Line numbers if you will refer to lines.
  5. Choose the Picture size: 1×, 2×, 3× or 4×. Leave Wrap long lines at 100 characters unless your lines must stay whole.
  6. Click Download PNG or Download SVG, or Copy image to paste it somewhere.

What each setting does

SettingOptionsWhen to change it
ThemeNight, Violet, Forest, Sand, PaperSand and Paper are light, for printed docs and slides with a light background
WindowThree dots, Plain bar, No barNo bar gives the most room to the code in a small space
Text sizeSmall, Medium, LargeLarge for slides and for phone screens
Space aroundNone, Small, Medium, LargeNone crops to the window, with no background and no shadow
Picture size1×, 2×, 3×, 4×2× for most uses, 3× or 4× for big screens and print
Wrap long linesOff, or at 60, 80, 100 or 120 charactersA 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
FontGeist Mono, your system's code font, CourierYour system's code font is SF Mono or Menlo on a Mac and Consolas on Windows
ShadowSoft shadow, No shadowNo shadow for a flat look on a slide. There is never a shadow with Space around set to None
Start at lineAny number from 0For a snippet from the middle of a file, so the numbers match your editor. Highlight lines uses these numbers too
Picture shapeFit the code, 16:9, 1:1, 4:5Widens 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 linesLine numbers like 3 or 2-4, 7Puts a band behind those lines and fades the rest, to point at the lines that matter
File name in the barAny text up to 60 charactersAlso 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.

How big the picture will be

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.

Long files, 4× and SVG

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.

Tips for a code image people will read

  • Keep it short. Show the few lines that matter and cut the setup around them.
  • Indent with spaces. Tabs are turned into two spaces, so a snippet indented with tabs may look tighter than in your editor.
  • Remove keys, tokens, passwords and private web addresses before you share. A picture is easy to zoom into.
  • Pick a background that is different from the page or slide it will sit on, so the window stands out.
  • Add the code as text, a link or alt text near the picture. Screen readers cannot read code in an image, and nobody can copy it.

When the colours look wrong

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.

On a Mac

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

Good to know.

Which languages are coloured?

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.

Is the picture sharp enough for slides?

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.

Can people copy the code from the picture?

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.

Copy image does not work.

Some browsers do not allow pages to put pictures on the clipboard. Use Download PNG instead.

Is my code uploaded?

No. It is drawn in this tab, so private code stays on your computer.

How do I get a see-through background?

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.

Can I change the font?

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.

Can I save a code screenshot as SVG?

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.

How do I make an image of a long file?

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.

Can the line numbers start at a different line?

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.

What size should a code image be for social media?

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.

How do I remove the window bar?

Set Window to No bar. The code then starts at the top of the window, and the file name is not shown.

Listed on

Listed on JustMacAppsMotionShine on Mac App IndexMotionShine on ScrollLaunchMotionShine featured on StartupBaseFeatured on FazierFeatured on Twelve ToolsMotionShine - Featured on Smol Launch