Free tool · lossless PNG

HTML to PNG

Paste HTML and CSS and download it as a PNG: sharp text, exact colours and no compression artefacts. Rendered by a real browser, free, no sign-up.

Add CSS (optional)

Rendered in a real browser (Chromium). Up to 1 MB of HTML; renders that need more than about 12 seconds are stopped. Images, fonts and styles must use absolute https:// URLs.

When to use PNG

ContentBest format
Text, UI, diagrams, code, logosPNG: lossless, sharp edges
Photos and large gradientsJPG or WebP: much smaller files
Images for the web where size mattersWebP

PNG files of photo-heavy pages get large quickly. If the file size matters more than perfect edges, switch the format to JPG or WebP in the tool, or use HTML to JPG.

Size and resolution

The size is the browser window in CSS pixels; Retina doubles it in both directions. Full height of the document captures everything below the window too, so long HTML becomes one tall PNG.

HTML to PNG in your code

POST /v1/take with html and "format": "png" returns the PNG; see the Render HTML documentation. The same endpoint renders HTML to PDF and captures websites by their URL.

Frequently asked questions

How do I convert HTML to PNG?

Paste your HTML, choose a size (for example 1200 × 630), keep the format on PNG and click Convert to image. Download the PNG when it appears.

Why PNG and not JPG?

PNG is lossless: text, thin lines and flat colours stay exactly as rendered. JPG is smaller for photos and gradients but blurs sharp edges a little. For screenshots of designs, UI and code, PNG is usually the better choice.

Can the PNG have a transparent background?

Not with this tool: the page gets a white background where your HTML sets none. Set the background colour you want on the body element.

How do I get a high-resolution PNG?

Tick Retina (2× pixels). A 1200 × 630 layout then becomes a 2400 × 1260 PNG, sharp on high-density screens. With the API, device_scale_factor goes up to 3.

HTML to PNG API

Turn HTML templates into PNGs from your code

POST /v1/take with html and format=png renders your HTML in Chromium and returns the PNG. Set the size, the pixel ratio and extra CSS, or capture the full height of the document.

/v1/take documentation HTML rendering API All documentation

300 free requests every month, and each PNG from HTML counts as one. No credit card required.

POST https://api.screenshotbase.com/v1/take

# Response: the PNG (image/png)
curl -X POST "https://api.screenshotbase.com/v1/take" \
  -H "apikey: YOUR-API-KEY" \
  -H "Content-Type: application/json" \
  -d '{"html": "<h1>Hello</h1>", "format": "png", "viewport_width": 1200, "viewport_height": 630, "device_scale_factor": 2}' \
  -o card.png

More free tools

Start using our Screenshot API for free today!

Get 300 requests / month for free