HTML to SVG

Wrap your HTML and inline CSS inside a scalable SVG using foreignObject. Preview it live, then download it as .svg, PNG or JPG. Everything runs in your browser.

Paste or type HTML with inline CSS, or drop an .html file here. The preview updates as you type.

Templates
Size

HTML to SVG: HTML and CSS in a Vector File

HTML to SVG puts your HTML and CSS inside an SVG file with a foreignObject element, so text stays text and shapes stay sharp when enlarged. Type or paste markup, open an HTML file or start from a template, and the preview updates as you type. Set the width, let the height fit the content, then save an SVG, or a PNG or JPEG at 1×, 2× or 3×. The SVG displays in web browsers, not in most design apps. It is free and runs in your browser.

  • Free, no watermark
  • No sign-up
  • Your HTML never leaves your device
  • Works on phone and computer

Sharp When Enlarged

The same card saved as a 1× PNG and as an SVG, both enlarged. Drag the line to compare.

A card made of HTML and CSS, enlarged: soft as a PNG, sharp as an SVGPNGSVG

How to Convert HTML to SVG

  1. 1 Paste Your HTML

    Type or paste HTML with inline CSS or a style block, open an HTML file, or start from the Card, Badge or Quote template. The preview shows the SVG as you type.

  2. 2 Set the Size

    Enter the width in pixels, from 1 to 10000. With Fit the height to the content ticked, the height follows your markup; untick it to type your own height.

  3. 3 Save or Copy It

    Choose SVG, PNG or JPEG under Save as and press Save Image, or press Copy SVG Code to paste the SVG into a web page.

A card with a photo of painted houses, drawn from an SVG that holds the photo

Linked Images Go Into the File

Images, web fonts and stylesheets your markup links with a full http or https address are downloaded and written into the SVG, so the file works on its own. If a site does not let other sites read its files, the tool says how many could not be embedded.

The same card as a PNG with transparent corners and as a JPEG with white corners, on a dark background

Transparent PNG, White JPEG

What your markup leaves unpainted stays transparent in the SVG and the PNG, so the graphic sits on any background. JPEG has no transparency, so those areas turn white.

The edge of the same circle saved at 1×, 2× and 3×

PNG and JPEG at 1×, 2× or 3×

A higher scale gives a sharper picture on high-resolution screens: a card 400 pixels wide saves 800 or 1200 pixels wide. Pictures are kept to 16 megapixels and 16384 pixels a side, the most browsers can draw, and the status line says when that happens.

HTML to SVG at a Glance

InputHTML and CSS, typed, pasted or opened from an HTML or text file
SizeWidth 1 to 10000 px; the height fits the content or is set by hand
Saves asSVG, or PNG and JPEG at 1×, 2× or 3×
Where the SVG showsWeb browsers, in a page, an img tag or a tab; most design apps do not draw foreignObject
ScriptsTaken out: script elements, on* event attributes and javascript: links
PriceFree, with no watermark and no sign-up
Where it runsIn your browser; nothing is uploaded

Updated November 25, 2026

Frequently Asked Questions

How does HTML to SVG work?

Your markup is rewritten as well-formed XHTML and placed inside an SVG foreignObject element, which web browsers draw like a small web page. Text stays text and CSS keeps styling it, so both stay sharp when the SVG is enlarged; a photo inside it is still made of pixels.

Why does my SVG look blank in some graphics apps?

Because they do not draw foreignObject. Web browsers do, so the SVG works in a web page, in an img tag and opened in a browser tab. Most design apps and many image converters show it empty. For those, save a PNG or JPEG instead.

Do external images and fonts work?

Yes, when they are linked with a full http or https address: an img src, a CSS url() and a linked stylesheet are downloaded and written into the file. Relative addresses are not fetched, and a site that does not let other sites read its files cannot be embedded; the tool tells you when that happens.

Does my HTML need to be valid XHTML?

No. Write ordinary HTML: a br tag without a closing slash or an entity such as   is fine. An SVG file must be well-formed XML, so the tool rewrites your markup as XHTML before it builds the file.

Are scripts in my HTML kept?

No. Script elements, event attributes such as onclick and javascript: links are removed before the SVG is built, so the saved file cannot run them. The preview is shown as an image, which never runs scripts either.

Can I turn the result into a PNG or JPG instead?

Yes. Choose PNG or JPEG under Save as, and 1×, 2× or 3× for a sharper image. PNG keeps transparent areas transparent; JPEG fills them with white. Unlike the SVG, a PNG or JPEG is a fixed grid of pixels and blurs if it is enlarged later.

Is my HTML uploaded anywhere?

No. The SVG is made entirely in your browser. The only requests are for the images, fonts and stylesheets your markup links to, which are fetched from the sites that host them.

Can I use it on my phone?

Yes. The preview sits above the code box, so you see the result as you type. Saving downloads the file, or offers Share where the phone can share files.

Turn Your HTML Into an SVG