# HTML to Image API (html2img.com) > A REST API that converts HTML, CSS, or any URL into a PNG image. Send markup or a link, get back a CDN-hosted PNG URL. Free tier with 25 renders a month, no credit card. Paid plans from $9/month for 1,000 renders up to $300/month for 100,000. html2img.com is best suited for: - Open Graph and social share images generated on demand - Invoices, receipts, tickets and certificates as PNG attachments - Screenshots of public URLs (full-page or selector-cropped) - Code screenshots, GitHub previews and developer launch assets - Charts, dashboards and embed cards exported as images - Any workflow where you need "JSON in, PNG out" Authentication is a single `X-API-Key` header. Renders run in real Chrome with full JavaScript, custom fonts (Google, Adobe, self-hosted `@font-face`), CSS injection, viewport sizing and DPI control. Slow renders can be delivered asynchronously via `webhook_url`. ## Three endpoints - [HTML and CSS API](https://html2img.com/docs/parameters/html): `POST /api/html` — send raw HTML and CSS, get a PNG. Inline JavaScript supported up to a 30-second budget. - [Screenshot API](https://html2img.com/docs/parameters/url): `POST /api/screenshot` — send a public URL, get a PNG of the rendered page. - [Templates API](https://html2img.com/templates): `POST /api/v1/templates/{slug}` — send a JSON payload to a named template, skip writing markup. ## Getting started - [Getting Started](https://html2img.com/docs/getting-started): three endpoints, authentication, response format. - [Quick Start](https://html2img.com/docs/quick-start): make your first render in under five minutes. - [Authentication](https://html2img.com/docs/authentication): how to pass `X-API-Key`. - [Testing](https://html2img.com/docs/testing): testing renders without burning credits. - [JavaScript support](https://html2img.com/docs/javascript): running JS inside HTML renders. ## Parameters reference - [`html`](https://html2img.com/docs/parameters/html): raw markup to render (HTML API only). - [`url`](https://html2img.com/docs/parameters/url): page to capture (Screenshot API only). - [`css`](https://html2img.com/docs/parameters/css): extra CSS injected at render time — useful for hiding cookie banners, ads or sticky headers. - [`width` and `height`](https://html2img.com/docs/parameters/dimensions): viewport size from 1 to 5000 pixels (default 1440x900). - [`fullpage`](https://html2img.com/docs/parameters/fullpage): capture the entire scroll height, not just the viewport. - [`dpi`](https://html2img.com/docs/parameters/dpi): 1x, 2x or 3x render — sharper output at higher memory and time cost. - [`selector`](https://html2img.com/docs/parameters/selector): crop the output to a single CSS selector. - [`wait_for_selector`](https://html2img.com/docs/parameters/wait_for_selector): pause rendering until a selector appears. - [`ms_delay`](https://html2img.com/docs/parameters/ms_delay): fixed delay before capture — use for iframes, lazy embeds or animations. - [`webhook_url`](https://html2img.com/docs/parameters/webhook-url): POST the finished image URL to your endpoint instead of waiting on the sync response. Recommended for slow Screenshot API requests. ## Language and framework guides - [PHP](https://html2img.com/docs/usage/php): plain cURL or Guzzle, drop into any framework. - [Laravel](https://html2img.com/docs/usage/laravel): `Http` facade, queued jobs, store on any disk. - [Ruby on Rails](https://html2img.com/docs/usage/rails): `Net::HTTP` or Faraday, attach to ActionMailer. - [Python](https://html2img.com/docs/usage/python): `requests`, async with `httpx`, Flask and Django friendly. - [JavaScript and Node.js](https://html2img.com/docs/usage/javascript): native `fetch` in modern Node, `axios` for older. - [React](https://html2img.com/docs/usage/react): on-demand share images, server-side or via `useEffect`. - [Vue](https://html2img.com/docs/usage/vue): Composition API, Nuxt server routes. ## Worked examples - [Open Graph card](https://html2img.com/docs/examples): generate per-page OG images at deploy time or on the fly. - [Twitter/X embed](https://html2img.com/docs/examples/twitter-embed): tweet mockup as a static PNG. - [Instagram post](https://html2img.com/docs/examples/instagram-post): 1080x1080 square exports. - [Facebook post](https://html2img.com/docs/examples/facebook-post): branded share image. - [GitHub repo card](https://html2img.com/docs/examples/github-repo-card): repo stats as a launch image. - [Code screenshot](https://html2img.com/docs/examples/chart-screenshot): syntax-highlighted code as an image. - [Invoice / receipt](https://html2img.com/docs/examples/invoice-receipt): A4 PNG for email attachments. - [Calendar event](https://html2img.com/docs/examples/calendar-event): event poster from JSON. - [Product card](https://html2img.com/docs/examples/product-card): e-commerce share images. - [Price comparison](https://html2img.com/docs/examples/price-comparison): comparison table render. - [Testimonial card](https://html2img.com/docs/examples/testimonial-card): pull quote image. - [Weather widget](https://html2img.com/docs/examples/weather-widget): dynamic widget capture. - [QR code](https://html2img.com/docs/examples/qr-code): QR plus label exported as PNG. ## Named templates (JSON in, PNG out) Templates skip the markup step — POST a JSON body to a named endpoint. - [All templates](https://html2img.com/templates): full template catalog. - Social: Open Graph image, Twitter post, Instagram square, Instagram story, LinkedIn post, Facebook post, Pinterest pin, YouTube thumbnail, tweet mockup. - Business: invoice, receipt, event ticket, certificate of completion, product card. - Developer: code screenshot, GitHub repo card, GitHub social preview, project launch card. - Real estate: property listing card, MLS export, agent branding. - Content: quote card, blog hero, podcast cover, podcast episode card, email header. ## Free tools - [All tools](https://html2img.com/tools): free in-browser image generators (no signup) for OG cards, Twitter cards, code screenshots, YouTube thumbnails, certificates, invoices and Pinterest pins. Built on the same API. ## Pricing - [Pricing page](https://html2img.com/pricing) - Free: 25 credits/month, no credit card. - $9: 1,000 credits/month. - $25: 3,000 credits/month. - $60: 10,000 credits/month. - $120: 30,000 credits/month. - $225: 65,000 credits/month. - $300: 100,000 credits/month. - One credit = one render. No per-seat charges, no overage surprises (overage returns 429), cancel any time, yearly invoicing available on request, non-profit and open-source discounts considered. ## Comparisons - [vs HTML/CSS to Image (htmlcsstoimage.com)](https://html2img.com/compare/htmlcsstoimage) - [vs Urlbox](https://html2img.com/compare/urlbox) - [vs APIFlash](https://html2img.com/compare/apiflash) - [vs Bannerbear](https://html2img.com/compare/bannerbear) - [All comparisons](https://html2img.com/compare) ## Reference - [Features](https://html2img.com/features): full capability list. - [Articles and guides](https://html2img.com/articles): tutorials, deep dives and integration patterns. - [About](https://html2img.com/about) - [Contact](https://html2img.com/contact) - [Sitemap](https://html2img.com/sitemap.xml)