Code Block Image Generator bishal-biswas.github.io | Bishal Biswas

Free Developer Tool - runs 100% in your browser

Code Block Image Generator

Preview
Text align
Block position
Vertical

Scroll down to learn more about this tool

Turn code into a clean, shareable image

This code block image generator turns a snippet into a syntax-highlighted PNG. Choose the programming language, paste your code and download the image. It works well for social posts, slides, documentation and tutorials, anywhere a plain text block would lose its formatting.

How to create a code image

  1. Pick a language, or leave it on Auto-detect.
  2. Type or paste your code. The preview updates as you go.
  3. Adjust the theme, background, font and alignment.
  4. Click Download image.

Splitting long code across multiple pages

Long snippets don't have to shrink into an unreadable image. There are three ways to spread them across several images:

  • Fixed image sizes such as Instagram Portrait fill each page and move the rest to the next one.
  • Lines per page starts a new page after the number of code lines you set.
  • Page breaks let you choose the split yourself. Put ---page--- on its own line, or use the Insert page break button.

Line numbers carry on from one page to the next and every page comes out the same size, which makes the results a good fit for carousels. Use Download all to get every page in a single ZIP file.

Aligning your code

  • Text align lines up each line of code to the left, center or right of the block.
  • Block position moves the whole block inside the window and keeps its indentation intact. This is usually what you want for code.
  • Vertical places the block at the top, middle or bottom, which shows on fixed sizes and on pages with fewer lines than the longest one.

Is my code private?

Yes. The image is drawn on a canvas in your browser and your code is never uploaded. Only the syntax highlighter and the fonts are downloaded from a public CDN, and they receive nothing you type. If your code is a mess, tidy it first with theJavaScript formatter or the SQL formatter.

More free developer tools