Convert HTML, CSS or any URL into a PNG image or a PDF document with a single API call. We render it in real Chrome and return the finished file within seconds.
<div class="card"> <img src="/logo.svg"> <h1>Ship faster with HTML to Image</h1> <span>/api/html</span> </div> /* one POST → one PNG */
Raw HTML for full control, the URL endpoint for screenshots, named templates to skip the markup, or the MCP server straight from your AI agent.
POST raw markup and CSS to the HTML endpoint. We render it in Chrome and return a PNG URL within seconds.
POST /api/html
{ "html": "<h1>Hello</h1>" } POST a public URL to the Screenshot endpoint. We load the page in Chrome and return a PNG of the rendered output.
POST /api/screenshot
{ "url": "https://example.com" } POST a JSON payload to a named template endpoint. We render a tested design with your data and skip the markup step.
POST /api/v1/templates/open-graph-image
{ "title": "Launch day" } Connect the MCP server to your AI agent and render images and PDFs straight from a tool call, no SDK to wire up. Paid plans.
html2img / MCP
render_html({ html }) Add format: "pdf" to the HTML or Screenshot endpoint and get back a real A4 document instead of a PNG. The output is vector, so text stays selectable and searchable, fonts are embedded, and long content paginates automatically.
POST /api/html
{
"html": "<h1>Invoice #1042</h1>",
"format": "pdf"
} Open Graph cards, Twitter posts, Instagram squares and stories. Render the same shape across every platform with one endpoint per spec.
See social templatesInvoices, receipts, event tickets and certificates. Send your line items, get back an A4 PNG you can attach to email.
See business templatesCode screenshots, GitHub social previews and project showcase cards. Built for changelogs, release notes and launch posts.
See developer templatesFull-page captures or selector-based crops. Inject CSS to remove cookie banners, ads or sticky headers before render.
See screenshot examplesSix designs developers reach for first.
Fill in the fields, see the result, then call the same renderer from your code.
Generate course completion certificates with recipient name, date, and signature.
Turn syntax-highlighted code into a shareable PNG with a custom theme and window chrome.
Render an invoice as a PNG to embed in email bodies without forcing a PDF attachment.
Build a 1200 by 630 share card from a page title, subtitle, and brand colours.
Build vertical 1000 by 1500 Pinterest pins from a title, an image, and a brand colour.
Turn a quote and an attribution into a 1080 by 1080 PNG for Instagram and LinkedIn.
Generate 1200 by 628 X share cards from a title, description, and brand artwork.
Build a 1280 by 720 YouTube thumbnail from a title, a face, and a brand colour.
Guides on rendering images for email, social, docs and your build pipeline.
Skip the 30 second sync timeout for slow renders. We POST the finished URL to your webhook.
webhook_url docsRender at 1x, 2x or 3x. Pick the right tradeoff between sharpness, memory and render time.
dpi docsGoogle Fonts, Adobe Fonts and self-hosted @font-face all work server-side without a CORS dance.
All featuresImages are served from i.html2img.com over a global edge CDN, delivered fast from a location near your users.
Response formatWorked guides for the seven languages developers use most. Any language that can make an HTTP request will work.
Plain cURL or Guzzle, integrate in any framework.
Use the Http facade, queue with jobs, store on any disk.
Net::HTTP or Faraday, perfect for ActionMailer attachments.
Requests library, async with httpx, drop into any Flask or Django app.
Native fetch in modern Node, axios for older versions.
Generate share images on demand, useEffect or server-side.
Composition API ready, works with Nuxt server routes.
The Open Graph image template renders 1200x630 social cards from a JSON payload, one call per share.
See the Open Graph image templateSide-by-side notes against htmlcsstoimage, Bannerbear, Urlbox and ApiFlash from the team that built HTML to Image.
Read the comparison hubWhat is the free tier?
25 renders per month covering images and PDFs, no credit card required. Every feature on the paid plans is available on the free plan, including templates, webhooks and DPI control.
Can I generate PDFs instead of images?
Yes. Set format to pdf on the HTML or Screenshot endpoint and you get back a vector A4 document with selectable text instead of a PNG. See the HTML to PDF API overview or the format parameter docs.
What languages can I use?
Any language that can make an HTTP request. We publish worked examples for PHP, Laravel, Ruby on Rails, Python, JavaScript, Node.js, React and Vue. See the language guides at /docs/usage.
What's the difference between the HTML and Screenshot endpoints?
The HTML endpoint accepts raw markup, runs your inline JavaScript, and returns a PNG. The Screenshot endpoint accepts a URL and captures the rendered page without running user-supplied JavaScript. Pick HTML for full control, Screenshot for capturing existing pages. The getting started guide covers both.
How accurate is the rendering?
We render in real Chrome, so flexbox, grid, custom properties, custom fonts and JavaScript work as they do in your browser. Pixel-perfect parity is the design target, not pixel-similar. See the features page.
How does HTML to Image compare to alternatives?
We have put together honest comparisons against htmlcsstoimage, Bannerbear, Urlbox and ApiFlash. Each covers pricing, features and migration effort.
What is a template?
A template is a named, parameterised image design hosted on our side. POST a JSON payload to its endpoint, get a styled PNG back, and skip the HTML step entirely. See /templates for the catalog.
25 images a month on the free tier. No credit card.