What does an HTML to image converter do?
Sometimes you have a design that exists only as HTML: a social card, a quote graphic, an email header, a small badge. To share it as a picture, you would normally open it in a browser and take a screenshot, then crop. This HTML to image tool skips those steps. You paste the code, set the pixel size and click Convert to Image.
There are two modes. HTML Code mode is the one to trust. The code is placed in a hidden box on the page, drawn onto a canvas by the html2canvas script, and turned into a PNG or JPG. URL / Website mode asks for a web address instead. It does not load the site directly. It sends the address to a third-party proxy, api.allorigins.win, and tries to read the page back inside a hidden frame. Browsers often block that last step, so expect failures.
The result is a close redraw of your HTML, not a true browser screenshot. Fonts that are not installed on your device, scripts, video and some modern CSS may not render the way they do on a live page.
How to convert HTML to an image
- Stay on the HTML Code tab and paste your markup into the box, or click a starter such as OG Image, Quote Card, Email Header, Card or Badge.
- Set Output Width (px) and Output Height (px). Use a preset like OG / Twitter 1200x630, or enter 0 as the height to capture the full height of the content.
- Pick PNG (best quality) or JPG (smaller). If you choose JPG, move the JPG Quality slider between 60 and 100.
- Click Convert to Image. The status badge changes from Rendering to Done, and a preview appears below.
- Check the preview, then click Download to save the file, or Copy Image to put it on your clipboard.
- If something looks off, edit the code and use Re-capture.
What this HTML to image tool includes
Two input modes
HTML Code renders markup you paste. URL / Website tries to render a public page by address, with the caveats described on this page.
Five starter templates
Card, OG Image, Quote Card, Email Header and Badge load sample HTML so you can edit a working design instead of starting blank.
Size presets
One click sets 1200x630 for link previews, 1080x1080 for square posts, 1920x1080 for Full HD, or an 800 or 1200 pixel wide full-page capture.
PNG or JPG output
PNG keeps text edges clean. JPG gives smaller files and has a quality slider from 60 to 100 percent.
Full-height capture
Set the height to 0 and the image grows to match the content, which suits long snippets.
Download or copy
Save the file as webpage.png or webpage.jpg, or copy the image straight to the clipboard where the browser allows it.
Who uses it, and for what
- Bloggers making link preview images. Edit the OG Image template with your title, render it at 1200x630 and upload the PNG as the share image. Pair it with the Open Graph Generator to write the tags.
- Developers documenting a component. Paste a styled snippet and export it as a PNG for a README or a ticket, with no screenshot tool needed.
- Email designers. Turn a header block into a flat image for tools that only accept pictures. Remember to add alt text in the email itself.
- Social media managers. Make quote cards and announcement graphics from a small HTML template, then reuse the template by changing only the text.
Tips for sharper, more reliable results
- Put styles inline or inside a wrapper element. Global rules such as
bodyor*in the pasted code can affect the whole page while it renders. - Use only fonts installed on your device, or a web-safe stack like Arial or Georgia. The tool does not wait for custom fonts to be fetched. If the exported PNG is heavy, shrink it afterwards with Compress Image.
- Images from other sites need to allow cross-origin use. If they do not, they may show blank. Data URIs always work.
- The scale is fixed at 1, so a 1200 pixel wide request gives a 1200 pixel wide file. Ask for double the size if you need a sharper image for high-density screens.
- Do not rely on scripts, iframes or video inside your HTML. They are not run or captured.
- Use URL mode only for a quick try. If it fails, copy the page source or just the part you want into HTML Code mode.
Is it safe? Privacy and limits
HTML Code mode runs entirely in your browser: your markup is drawn on a canvas on your device and never sent to us. URL mode is different. The address you type is sent to a third-party proxy, api.allorigins.win, which fetches that page. Do not use URL mode for private or logged-in pages. The html2canvas library is loaded from the jsDelivr CDN when the page opens.
HTML to image FAQ
Paste your HTML into the HTML Code box, set the width and height, pick PNG or JPG and click Convert to Image. The tool draws your code inside a hidden element, captures it with the html2canvas library and shows the result as a preview. You then press Download to save it. For the best result, use inline CSS and keep the design inside one wrapper element. Entering 0 as the height makes the picture as tall as the content, which is handy for long snippets.
Not reliably. URL mode sends the address to a third-party proxy and loads the returned page inside a hidden frame, then tries to read that frame to draw it. Browsers often refuse that last step because the frame comes from a different origin, so you may see an error such as Cannot access page content. Pages with scripts, logins or heavy layouts often fail or look wrong. For a faithful screenshot, use your browser's own capture feature, or paste the relevant HTML into HTML Code mode.
1200 by 630 pixels is the common size for link preview images, and it is the first preset in this tool and the default for the OG Image template. It gives a wide 1.91 to 1 shape that most social sites crop cleanly. Keep key text away from the edges, because some apps trim a little. After you export the file, upload it to your site and reference it with an og:image tag, which the Meta Tag Generator can write for you.
Use PNG for graphics with text, flat colors and sharp edges, because it is lossless and keeps letters crisp. Use JPG when the design contains photos and you want a smaller file. The JPG Quality slider runs from 60 to 100 percent, and about 90 is a good balance. JPG has no transparency, so a transparent area will turn white. The tool paints a white background behind your HTML in either format.
The capture library draws from what your browser has already loaded, and it cannot fetch everything. Custom web fonts may not finish loading, so text falls back to a default font. Images from another domain only appear if that site allows cross-origin use. The fix is to use installed fonts, and to embed images as data URIs or host them on a domain that allows it. Background images set in CSS can also be skipped in some cases.
No. The converter draws a still picture of the markup and its styles. JavaScript you include is not meant to run, animated CSS is captured as a single frame, and video or iframes will not appear. Some newer CSS effects, such as certain filters, blend modes or complex gradients, may also render slightly differently from a real browser. If a design depends on those, check the preview carefully before downloading.
In HTML Code mode, no. The code stays in your browser and is rendered locally, so private drafts are safe to use. In URL mode the web address you enter is passed to a third-party proxy so the page can be fetched, so avoid it for private pages. Either way, the library that does the drawing is downloaded from a CDN when the page loads, so you need an internet connection for the first load.
This tool captures at a scale of 1, with no pixel ratio option, so the file is exactly the width and height you enter. To get a sharper result, design for a larger canvas, such as 2400 by 1260 instead of 1200 by 630, and show it at half size on your site. Limits are 3840 pixels for width and 4320 for height in the input fields. Very large captures can be slow on phones and older computers.