Skip to content

Encoding

SVG & Data URI Converter

Encode SVG markup as a compact data URI or decode an SVG data URI back into source text.

How to use this tool
  1. Paste SVG markup or an SVG data URI.
  2. Choose encode or decode.
  3. Copy the URI or source for use in your project.

Loading tool…

About this tool

What is SVG & Data URI Converter?

Convert small SVG source into a data URI for a CSS background or reverse an existing SVG data URI into inspectable text. Encoding protects characters that otherwise have special meaning in a URL, particularly the number sign used by HEX colors. Keep an editable source copy, because an encoded URI is less convenient for later design changes.

A worked example

Encode markup instead of inserting raw angle brackets into a URL

Example input

<svg/>

Expected result

data:image/svg+xml,%3Csvg%2F%3E

The minimal sample demonstrates the encoding and is not a useful drawing. The angle brackets and slash become percent-encoded bytes after the SVG media-type prefix. For an actual icon, include the correct SVG namespace, viewBox and artwork in the source, then test the complete URI in the destination where it will be used.

Common mistakes and limits

  • Encoding does not validate or sanitize an SVG. Review untrusted markup before using it in a context that can execute active content.
  • Large encoded artwork makes CSS harder to maintain. A separate SVG asset is often easier to cache and update.

Features

What you can do

  • Percent-encoded SVG data URIs
  • Decode Base64 SVG data URIs
  • Validate the SVG root element
  • Source-only conversion without executing SVG

Frequently asked questions

Questions about SVG & Data URI Converter

Is the resulting SVG sanitized?

No. Encoding does not remove scripts, external references or other unsafe SVG content. The tool does not render the SVG; review source before using it in another application.

Related tools