Paste a piece of code and get a clean image of it, ready for a post, a slide or a document. Choose a language for the colours, a theme, the text size and the padding, and turn line numbers and the window bar on or off. The image is drawn in your browser and you download it as a PNG. The colours are simple and based on word patterns, so they will not match a full code editor.
Colours are simple and based on word patterns, not a full code parser. Very long lines make a wide image, and the first 200 lines are used.
Features
- Simple colours for JavaScript, Python, HTML, CSS and JSON
- Three themes, line numbers and an optional window bar
- Adjust text size and padding, with a live preview
- Download as a sharp PNG at double resolution
How to use Code to Image
- Paste your code and choose the language.
- Pick a theme, text size and padding.
- Download the PNG.
Frequently asked questions
How good is the colouring?
It is basic. Keywords, text between quotes, numbers and comments get a colour, based on word patterns. It does not understand the code, so unusual syntax can be coloured wrongly. Choose plain text if you want no colours.
Which font is used?
The monospace font of your own device, so the image can look slightly different on another computer or phone. The image you download is a fixed picture, so it looks the same everywhere afterwards.
Is there a limit to the length?
The first 200 lines are used. Very long lines make a wide image, which becomes small when it is shown on a narrow screen, so split long lines first if you want it to stay readable.
Is my code uploaded?
No. The image is drawn in your browser and nothing is sent anywhere. You can check this yourself: switch off your internet connection after the page has loaded and the tool still works.