Code Snippet HTML Formatter screenshot

Code Snippet HTML Formatter

Format code snippets into highlighted HTML blocks.

Privacy First
0 Runs
Updated 2026-11-07
Runs in your browser
No account needed
Nothing sent to a server
Works offline after load

Format code snippets into highlighted HTML blocks. Enter your numbers and get an instant result.

Paste a code snippet, pick a background gradient, a window style and an outer padding, and this page renders a mock window around the code and exports it as a PNG named `code_screenshot.png`.

The preview is the export. The same element is handed to the browser's canvas renderer, so what you see in the panel is what lands in the file, including the three traffic-light dots of the macOS title bar or the minimise and close glyphs of the Windows one.

The code is drawn as plain monospaced text in a single colour. There is no syntax highlighting, no line numbering and no theme list beyond the four gradients and three title bars.

What the export actually captures

The capture target is the rounded box holding the mock window, not the whole page. Gradient choice, title bar and padding are all inside it, so all three are in the PNG.

The renderer runs in the tab against the live DOM. If the capture fails, the page shows the renderer's own message under the export button instead of producing a file.

The downloaded name is fixed at `code_screenshot.png`, so a second export is numbered by the browser — `code_screenshot (1).png` — rather than named by you.

  • Gradients: Sunset Glow, Ocean Deep, Cosmic Space, Emerald Forest
  • Window styles: macOS Dark, Windows Dark, Minimalist
  • Padding: small, medium and large

Getting a clean image

Long lines are horizontally scrollable in the preview, and what scrolls out of view is not captured. Wrap your code before pasting if a line runs past the panel.

Emoji and unusual glyphs depend on the fonts installed on your machine, so the same snippet can render slightly differently in someone else's browser.

How to use the mockup settings

Paste the snippet into Source Code, pick one of the four Background Gradients, a Window Style with macOS traffic lights or Windows glyphs, and an Outer Padding of Small, Medium or Large.

Check the Mockup Preview, then press Export PNG Image to save `code_screenshot.png`. The preview is the export, drawn as plain monospaced text with no syntax highlighting and no line numbers.

What to Expect

Best for

  • A shareable image of a short snippet for a slide or a post
  • Making a mock-up of a code window around a command
  • Producing a consistent image of the same snippet for documentation

Not ideal for

  • Long files, where only the visible width is captured
  • Syntax-coloured output, which this page does not produce
  • An image you can edit later, since the export is a flat PNG

What this tool keeps

  • The exact characters you pasted, including indentation
  • The chosen gradient, title bar and padding in the file
  • A fixed output name, so exports are easy to find

What may need cleanup

  • A line that scrolled out of the preview and is missing from the image
  • Emoji or ligatures that depend on local fonts
  • The fixed filename, which the browser numbers on a repeat export

Common errors

  • Pasting a hundred-column line and losing its end in the capture
  • Expecting highlight colours from a plain-text render
  • Pressing export with an empty editor, where the button stays disabled

Example use cases

  • A config snippet for a slide deck
  • A terminal command for a social post
  • A before-and-after code comparison in a blog article

Sample input

The default snippet, a Sunset Glow gradient, the macOS title bar and medium padding.

Sample output

A PNG named code_screenshot.png showing the function inside a rounded window on an orange-to-indigo gradient.

Who this is for

  • Developers writing posts and slides
  • Technical marketers producing social images
  • Anyone who needs code to look like a screenshot

Frequently asked questions

What does the exported PNG contain?

The code as pasted, inside a mock window with the gradient, title bar and padding you chose, saved as code_screenshot.png.

Does it add syntax colouring?

No. The export is a flat, unstyled PNG; syntax colouring has to come from the snippet itself.

Why is a long line missing from the image?

The export captures the visible width, so a line that scrolled out of the preview is not in the file.

Developer program

Build custom tools for your store

Join the SDK program to create useful ecommerce utilities for your store.