HTML to Image Converter — Free, PNG & JPG, No Upload
Convert HTML and CSS to PNG or JPEG images instantly. Paste your code, preview it live, and download — no upload needed.
HTML Code Editor
Live Preview
Higher scale = better quality but larger file size.
10-100, higher = better quality.
Note: external images and custom fonts may not appear in the downloaded file (browser security). They display correctly in the live preview.
Turn any HTML snippet into a shareable image
Paste HTML and CSS, set the pixel dimensions you need, and download a PNG, JPEG, or WEBP — an Open Graph card, a Twitter/X preview, an email banner, a certificate, a design mockup, or a styled code snippet. It converts the markup you paste (not a live URL), and it does the whole job inside your browser tab: your code never touches a server, which is why there’s no upload step, no queue, and no file-size cap.
Once you have the image you can compress it, convert it to another format, or — if you actually need a document with selectable text rather than a flat image — turn the same HTML into a PDF instead.
How it actually works (and why that explains every quirk)
This isn’t a screenshot. When you click Download, your markup is wrapped in an SVG <foreignObject>, serialized to a data URL, painted onto an HTML <canvas>, and read back out with canvas.toDataURL() — all client-side. That one pipeline explains the three things people most often trip over.
JavaScript never runs. The foreignObject approach captures a static snapshot of the DOM, so if your layout depends on a script to build itself, render it to its final state first, then paste the result.
Cross-origin fonts and images can drop out. The canvas refuses to export once it has been “tainted” by an asset loaded from another domain — so a Google Font linked by URL shows in the live preview but quietly vanishes from the download. The fix is to inline it: embed the font as a base64 @font-face rule, or fall back to a system font.
Scale is real resolution, not zoom. Set Scale to 2x and the layout is rasterized at double density, so a 1200×630 design exports at 2400×1260 pixels — exactly what retina timelines want.
A worked example: a 1200×630 Open Graph card
Say you want an og:image for a blog post. Pick the OG Image (1200×630) preset, paste a self-contained snippet like this, set Scale to 2x, and download. Because the styles are inline, it renders identically in the preview and the export:
<div style="width:1200px;height:630px;display:flex;
flex-direction:column;justify-content:center;
padding:80px;box-sizing:border-box;color:#fff;
font-family:Georgia,serif;
background:linear-gradient(135deg,#1e3a8a,#7c3aed)">
<p style="font-size:28px;opacity:.8;margin:0">ultimatetools.io</p>
<h1 style="font-size:72px;line-height:1.1;margin:16px 0 0">
How to Make an Open Graph Image
</h1>
</div>At 2x that exports a crisp 2400×1260 PNG of roughly 180 KB. Switch the format to JPEG at the same size and it drops to about 40 KB on a white background — fine for an email banner, but keep PNG or WEBP if you need the gradient razor-sharp or the background transparent.
Social image size cheat-sheet
Match the width and height to where the image will appear so it renders sharp and uncropped:
| Placement | Dimensions (px) | Notes |
|---|---|---|
| Open Graph (Facebook, LinkedIn) | 1200 × 630 | The 1.91:1 default for link previews |
| Twitter/X summary_large_image | 1200 × 628 | Near-identical to OG — safe to reuse |
| Instagram square post | 1080 × 1080 | 1:1, also fine for the LinkedIn feed |
| Instagram / Facebook Story | 1080 × 1920 | 9:16 full-screen vertical |
| YouTube thumbnail | 1280 × 720 | 16:9 — keep text out of the bottom-right |
Save HTML as an image in three steps
- 1. Paste your HTML and CSS into the editor — the live preview renders as you type. To load a file instead, switch to the Upload HTML tab and pick a .html file (it is read in your browser, not uploaded).
- 2. Set the size in pixels or choose a preset, and bump Scale to 2x for high-DPI output.
- 3. Choose PNG, JPEG, or WEBP and click Download. PNG and WEBP keep transparency; JPEG is the smallest on a white background.
How it compares to the alternatives
This tool is the fastest route when you already have the HTML and want an exact-dimension image with nothing installed. It is honestly not the right choice for capturing a live, JavaScript-heavy page — for that, reach for a headless browser. The trade-offs:
| Approach | Captures a live URL? | Install needed? | Cross-origin assets | Cost |
|---|---|---|---|---|
| This tool (paste HTML) | No — you paste markup | None | Inline them yourself | Free |
| Browser DevTools screenshot | Yes | None | Handled | Free, but manual & fixed size |
| html2canvas (JS library) | In your own app only | Yes (npm) | Partial | Free |
| htmlcsstoimage.com (API) | Yes | API key | Handled | Paid |
| Puppeteer / Playwright | Yes | Yes (Node + server) | Handled | Free, heavy setup |
Need a pixel-perfect shot of a live page that runs scripts? Puppeteer or a DevTools capture will beat this every time. Just turning a card or template into an image? Pasting it here is faster than all of them.
Common problems — and the fix
- The download is blank or missing part of the layout
- Usually a cross-origin image tainted the canvas. Swap remote images for base64 data URIs, or host them on the same domain, then export again.
- Your web font didn’t render
- foreignObject can’t fetch an external font mid-export. Inline it as a base64
@font-facerule, or use a system stack like-apple-system, Segoe UI, Roboto, sans-serif. - Your Tailwind CSS classes didn’t apply
- Same root cause as the fonts: an external stylesheet isn’t loaded during export, so utility classes from a Tailwind CDN or build silently do nothing. Inline the styles you need directly on the elements, or paste them into the Custom CSS tab, instead of relying on Tailwind classes.
- Text looks soft or pixelated
- You exported at 1x. Set Scale to 2x or 3x so the layout rasterizes at higher density.
- A transparent area came out white or black
- JPEG has no alpha channel. Export as PNG or WEBP to keep transparency; JPEG fills it with the background colour.
When not to use this tool
If you want a screenshot of a live website — especially one behind a login or one that builds itself with JavaScript — this is the wrong tool; a browser screenshot or Puppeteer will serve you better. If you need a multi-page, print-fidelity document with selectable text, convert your HTML to a PDF instead. This tool is built for one job and does it well: turning self-contained HTML and CSS into an exact-size raster image.
Frequently asked questions
Yes — pick the format before you download. PNG is lossless and keeps transparency; WEBP is the smallest at similar quality and also supports an alpha channel; JPEG is small but flattens onto a white background.
They show in the live preview but can drop from the download, because the canvas cannot export once a cross-origin asset taints it. Inline images as base64 and fonts as @font-face rules to guarantee they render.
No. The export captures a static snapshot via SVG foreignObject, so scripts do not execute. Render your content to its final state, then paste that HTML.
Set Scale to 2x or 3x. A 1200×630 design at 2x exports at 2400×1260 pixels — crisp on high-DPI screens.
Yes. Set Background to Transparent in Advanced Image Options and export as PNG or WEBP (both have an alpha channel). JPEG falls back to white.
Yes. The conversion happens entirely in your browser, so there is no server, no signup, no watermark, and no file-size limit.
From Our Blog
Related Tools
convert HTML to PDF free with selectable text
Need a document instead of an image? Export the same HTML to a real PDF
PDF Toolsdownload a YouTube thumbnail in HD
Grab the full-resolution thumbnail from any YouTube video
Image ToolsImage Compressor
Compress JPEG, PNG, and WEBP images for free
Image ToolsImage Converter
Convert images between JPG, PNG, WEBP, and more
Image ToolsImage Resizer
Resize images to exact pixel dimensions
Image Tools