Social cards · Offer banners · Quotes · Snippets
HTML to Image Converter
Your HTML and CSS.
One image to share.
Paste code, load an .html file or start from a template, pick a size such as 1200 × 630, and turn it into a PNG, JPG or WebP at 1×, 2× or 3× sharpness. Scripts never run, and your code stays in this browser.
A sample is loaded. Press Make image to see it, or start from a template.
Check it, then save it
The image is drawn by html2canvas, which rebuilds the page rather than taking a screenshot. Shadows, filters, blend modes and some newer CSS can look different, so check the preview before you use the file.
Pick the size
Width sets the layout. Sharpness sets the pixels.
Choose the width your design was written for, then decide how many pixels the file needs.
| Setting | What it does | When to use it |
|---|---|---|
| Social share 1200 × 630 | Fixed size, the usual shape for link previews. | Blog posts and pages that need an Open Graph image. |
| Square 1080 × 1080 · Story 1080 × 1920 | Fixed square or tall image. | Quote cards, offer posts and status updates. |
| Email banner 600 × 200 | A short, wide strip. | The header of a newsletter or an email signature banner. |
| Fit height to content | Measures how tall the HTML is and makes the image that tall. | Cards, receipts and code snippets whose length varies. |
| Sharpness 2× or 3× | Draws the same layout with two or three times the pixels on each side. | Crisp text on phones and high-resolution screens. |
| Transparent background | Leaves areas the HTML does not paint see-through in PNG and WebP. | Badges and buttons placed over another design. |
Writing HTML for an image
Keep it self-contained, keep it simple.
Put the CSS in the page
Use a style block, the CSS box or style attributes. Linked stylesheets and @import are never fetched.
Use fonts the device has
Arial, Georgia, Verdana and system fonts work. Web fonts are not loaded, so a Google Font falls back to a default.
Embed small pictures
A logo written as a base64 data image works offline. For https:// images, turn on Web images first.
Give the box a size
Set the outer box to the image height, as the templates do, so flex centring and backgrounds fill the frame.
Pixels, worked out
Multiply both sides, then check the limit.
The file size in pixels is the width and height times the sharpness, up to 4,096 px a side and 8 MP.
| Layout size | Sharpness | Image | Result |
|---|---|---|---|
| 400 × 200 | 1× | 400 × 200 px | Made |
| 400 × 200 | 2× | 800 × 400 px · 0.32 MP | Made, with sharper text |
| 1200 × 630 | 2× | 2400 × 1260 px · 3.0 MP | Made |
| 1080 × 1920 | 2× | 2160 × 3840 px · 8.3 MP | Over 8 MP; the tool offers 1× instead |
| 2000 × 1500 | 2× | 4000 × 3000 px · 12 MP | Over 8 MP; the tool offers 1× instead |
Sharpness adds pixels to text, borders and gradients. A small photo inside the HTML is only enlarged; it does not gain detail.
How the image is made
A private frame. No scripts, no outside files.
Your code is cleaned and drawn in a hidden, locked-down frame on this page.
From code to one file
What people make
A design in code, a picture to post.
| Use | Setup | What to check |
|---|---|---|
| A Diwali or wedding-season offer for a shop's WhatsApp status | Festival offer template · Story or Square · JPG | Change the shop name, dates and number; keep the main line large enough to read on a phone. |
| A social share image for a blog post | Social share 1200 × 630 · 1× · PNG | Keep text away from the edges, which some apps crop in previews. |
| A code or terminal snippet for a tutorial | Fit height to content · 2× · PNG | Use a monospace font such as Courier New, and keep the code as text on the page as well. |
| An email header or newsletter banner | Email banner 600 × 200 · 2× · JPG | Write the same words as alt text in your email, since some readers block images. |
| A file of the wrong size or format | Download PNG first | Change it with the Image Resizer or Image Converter. |
Troubleshooting
When the image does not match the code.
It looks different from the browser
html2canvas supports most, not all, CSS.
- Replace shadows and filters with borders.
- Avoid blend modes and clip-path.
- Write colours as hex, such as #1f2b28.
An image or font is missing
Outside files are blocked unless you allow them.
- Turn on Web images for https:// pictures.
- Or embed the picture as base64.
- Pick a font the device already has.
The bottom is cut off or empty
A fixed height crops longer content.
- Tick Fit height to content.
- Or raise Height.
- Give the outer box the same height.
Make image shows an error
The message above the preview names the cause.
- Over 8 MP: use the offered sharpness.
- Engine not loading: check the connection.
- Over 30 seconds: simplify the HTML.
HTML to image questions
Before you convert your code
How do I convert HTML to an image?
Paste your HTML and CSS, or start from a template, choose a size and press Make image (or Ctrl / Cmd + Enter in the code box). Check the preview, then press Download image for a PNG, JPG or WebP, or Copy image to paste it somewhere.
How do I make a social share (Open Graph) image?
Press Social share under Size for 1200 × 630, write a box of that size with your title, and download it as PNG or JPG. Then set that file as the page's og:image in your site or SEO plugin.
Why does my image look different from the browser?
The image is drawn by html2canvas, which rebuilds the layout from the HTML and CSS instead of taking a screenshot. Box shadows, filters, blend modes, newer colour formats such as oklch() and web fonts can look different or be skipped, so check the preview.
Do JavaScript, web fonts and linked stylesheets work?
No. Scripts never run, and linked stylesheets, @import, web fonts and CSS background images are removed before drawing. Put the CSS in the CSS box or a style block, and use fonts the device already has.
Can I convert a live website to an image?
Only partly. Web page can fetch a public page's HTML through AllOrigins, but its scripts and linked stylesheets are not used, so most sites look plain. For an exact picture of a live site, use your browser's own screenshot tool.
Can I use images inside the HTML?
Yes. Images written as base64 data work straight away. https:// images load only after you turn on Web images, and the image server must allow it. Up to 20 PNG, JPG, WebP, GIF, BMP or AVIF images, 2 MB and 8 MP each.
What do sharpness and Fit height to content do?
Sharpness multiplies both sides, so 1200 × 630 at 2× gives a 2400 × 1260 px image. Fit height to content measures how tall the HTML is; with it off, the image uses your height and cuts off anything below.
What are the size and file limits?
HTML up to 1 MB, CSS up to 250 KB and 3,000 elements. The layout can be 100 to 4,096 px wide, and the finished image up to 4,096 px a side and 8 MP. If a sharpness is too big, the tool offers a smaller one.
Can I get a transparent PNG?
Yes. Leave Background behind the HTML on Transparent and choose PNG or WebP. Anything the HTML does not paint stays see-through. JPG cannot be transparent, so those areas turn white.
Is my code sent to a server?
No. Code you paste or load from a file is drawn in this browser tab. Only the options you turn on contact other servers: Web page sends the address to AllOrigins, and Web images contacts the image servers. Only the Appearance choice is remembered.
Related image tools
Finish the image for where it goes next.
Ready to turn your HTML into an image?
Back to your code, or browse the image tools and the full tools directory.