Code to image
Use this code to image tool to turn a code snippet into a picture you can share. Paste your code, choose a language and a colour theme, and download the image. You do not need an account to use the free tool.
- Lines are not wrapped. A long line makes the image wider, and tabs become 4 spaces.
- The font is Liberation Mono only. Characters it does not contain are drawn in a fallback font and may not line up.
- In the free tool the image height is limited to 2000 px at 1x. The tool says so when your code is taller.
3 KB of 256 KB allowed in the free web tool.
Detected language: javascript. 7 lines. Image: 516 x 346 px at 1x.
Preview
Drawn with your browser's fonts, so spacing can differ slightly from the server's result.
Complete the human check to enable the button.
Result
Your image will appear here.
The free web tool captures at most 2000px of height. For taller captures, use the API.
Retention: web-tool results are deleted after 10 minutes and no history is kept. API results are kept 1 day on the free plan and 7 days on Starter and Pro (30 days on Business).
No account needed
10 per minute and 50 per day for free.
Real browser rendering
Headless Chromium, the same engine as the API.
Deleted automatically
Web tool results are removed after 10 minutes.
Privacy: what you submit is used only to make this file. The working copy is deleted when the job ends, the result after 10 minutes. See the privacy policy.
Do this from your code
The same request, built from the input and options above. Create an account to get an API key.
curl -X POST https://api.aiipworld.com/v1/render \
-H "Authorization: Bearer $AIIPWORLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"html":"","output":"pdf","options":{}}'
# returns {"job_id": "...", "status": "queued"}; then poll:
curl https://api.aiipworld.com/v1/jobs/JOB_ID -H "Authorization: Bearer $AIIPWORLD_API_KEY"Batches
The web tool handles 1 document at a time. The API takes one request per document, so you can script as many as your plan allows.
More control
Whole-page capture (full_page), clipping to a region, request headers and a custom user agent are API options. See the docs.
Retention
Web-tool results are kept 10 minutes; free API results 1 day; Starter and Pro results 7 days; Business 30 days. The web tool allows 10 conversions per minute and 50 per day per visitor.
In one sentence
A free online tool that turns a code snippet into a shareable image with syntax colours, a theme and an optional window frame.
Key facts
- Input: code, with automatic language detection or a choice of 21 languages.
- Themes: Midnight, Paper and Graphite; backgrounds: Ocean, Sunset and Mint gradients, Slate, White or Transparent (PNG only).
- Output: PNG or JPG at 1x, 2x or 3x (2x by default), up to 4000 px wide and 2000 px tall at 1x; the code is set in Liberation Mono and lines are not wrapped.
- Free without an account: up to 10 conversions per minute and 50 per day per visitor, no watermark. Signed in, each render costs 1 credit (100 free credits every month).
- Files are deleted automatically: 10 minutes after conversion without an account, 1 day with a free account.
- Developers can run the same render with POST https://api.aiipworld.com/v1/render and an API key (see the screenshot API page).
How it works
- Paste your code into the box, or leave the default sample in place to try the tool.
- Pick a language from the list, or leave it on automatic detection.
- Choose a colour theme and a background. Turn line numbers or a window title on if you want them.
- Set the text size, padding, format (PNG or JPG) and pixel density (1x, 2x or 3x).
- Complete the quick human check if it appears, create the image and download the file.
Example output
How to turn code into an image
Paste the code you want to show, and the tool draws it as a picture. You do not need to install software or create an account. Anonymous use asks for a quick human check first.
The image is sized to the code. The width follows the longest line, and the height follows the number of lines. You can add outer padding around the code.
Common uses are documentation, social posts and slides.
Languages and colours
Pick the language from the list, or let the tool detect it. The 21 languages are JavaScript, TypeScript, Python, JSON, Shell, CSS, HTML/XML, SQL, Go, Rust, Java, C, C++, C#, PHP, Ruby, YAML, Markdown, Diff, Kotlin and Swift.
The colour theme sets the look of the window. Midnight is dark, Paper is light and Graphite is dark grey.
Backgrounds, window and line numbers
Pick one background: the Ocean, Sunset or Mint gradient, a plain Slate or White background, or Transparent.
- Transparent works for PNG only. JPG has no transparency, so a transparent background is saved as white.
- Window dots: three coloured dots are drawn in CSS to give the image a window frame.
- Window title: add a short text in the title bar of the window.
- Line numbers: turn them on for code that you discuss line by line.
Image size and sharpness
Set the text size in pixels. The range is 10 to 32 px. Outer padding is set in pixels too.
Pixel density is 1x, 2x or 3x. The default is 2x. Choose 3x when the image will be shown large.
Choose PNG or JPG. Use PNG when you need a transparent background.
In the free tool the height is limited to 2000 px at 1x. The tool shows a message when the image is over that limit.
Fonts
The image uses Liberation Mono, a monospace font. It covers Latin, Greek and Cyrillic letters.
Characters the font lacks, such as Chinese, are drawn with a fallback font. Those characters may not line up on the monospace grid.
You cannot pick another font in this tool. Fonts from your own computer are not on the render server. To use another font, make the image with the HTML to image tool and load the font with @font-face from a public URL or a data URL.
Long lines and long files
Lines are not wrapped. A long line makes the image wider. Break long lines in your source before you paste them if the image gets too wide.
Tabs become 4 spaces, so the indentation in the image can differ from your editor.
A long file makes a tall image. The free tool caps the height at 2000 px at 1x. For a longer file, split it into parts and make one image for each part.
Code to image from code
If you make many images, use the API instead of the web tool. The API has a screenshot operation that takes HTML. Wrap your code in HTML, escape it so that characters such as < and & show correctly, and send it to the screenshot operation.
Create an API key in the dashboard. Send it as Authorization: Bearer followed by the key, or as the x-api-key header. Keep the key secret and do not publish it.
Requests are asynchronous. POST to /v1/render and you get a job ID back with a 202 response. Poll GET /v1/jobs/ with that ID until the status is succeeded, failed or timeout. Then download the file from the download link, which is short-lived. Credits for failed and timed-out jobs are returned. There is no batch endpoint, so send one request for each image.
Before you share a code image
A code snippet image is a picture, so anyone who sees it can read every line. Remove keys, passwords and personal details from the code before you paste it.
This code to picture tool suits guides and talks. Check the language you chose, decide whether you need line numbers, and pick a pixel density that suits where the picture will appear.
If you want a code to PNG file that sits on a slide with no box behind it, choose PNG and the Transparent background. Transparent works for PNG only.
Questions
How do I turn code into a picture?
Paste your code into the tool, choose a language and a colour theme, then download the image as a PNG or JPG. You do not need an account to use the free tool. A quick human check may appear first.
Which languages are supported?
You can choose from 21 languages: JavaScript, TypeScript, Python, JSON, Shell, CSS, HTML/XML, SQL, Go, Rust, Java, C, C++, C#, PHP, Ruby, YAML, Markdown, Diff, Kotlin and Swift. You can also leave the language on automatic detection.
Can I get a transparent PNG?
Yes. Choose the Transparent background and save the file as PNG. Transparency is not available for JPG, because JPG has no transparent channel and a transparent background is saved as white.
Why is the text not wrapped?
Lines are not wrapped. The image is sized to the longest line, so a long line makes the image wider. Break long lines in your code if you need a narrower image.
Can I use my own font?
Not in this tool. The image always uses Liberation Mono. To use another font, make the image with the HTML to image tool and load the font with @font-face from a public URL or a data URL.
How big is the image?
The size follows your code. The width comes from the longest line and the height from the number of lines. In the free tool the height is limited to 2000 px at 1x, and pixel density 1x, 2x or 3x scales the output.
Is my code stored?
Results are deleted after 10 minutes, and no history of your conversions is kept. Do not paste keys, passwords or other secrets into any online tool.
Can I make a JPG?
Yes. Choose JPG as the format. JPG has no transparency, so a transparent background is saved as white. Choose PNG if you need a transparent background.
How do I do this from a script?
Use the API. Its screenshot operation takes HTML, so wrap your code in HTML and send it with your API key. Then poll the job until it succeeds and download the file.
Does the image have a watermark?
No. We add no watermark to images from the free tool. Anonymous use needs a human check, and signed-in users skip that check.
Is the tool free?
Yes. The code to image tool is free to use without an account. The API needs an API key and uses a plan with credits.
Can I make a code screenshot without installing software?
Yes. Paste the code, choose a language and a colour theme, and download the image. The tool runs in your browser and on our render server, so there is nothing to install. You do not need an account for the free tool, though a quick human check may appear first.
Can I use a code picture in a blog post or on slides?
Yes. Place the PNG or JPG in a blog post, a slide deck or a social post. We add no watermark to images from the free tool. Before you share the picture, check that the code holds no keys or passwords, because anyone who sees it can read it.
Can I turn a short function into a picture for a social post?
Yes. A few lines work well as a picture, because the image is sized to the code and a long file makes a tall image. Pick a theme and a background that suit your feed, then download the PNG. Choose 2x density if the post will be shown large.
Need this in your app or in bulk?
This tool runs on the render API, so the same image is one HTTP request from your code. A free account includes 100 credits a month.
