cd .. (all tools)

SVG optimiser

Shrink an SVG, or turn it into a data URI.

// Runs in your browser. Nothing you type here is sent anywhere.

1.3 kB → 388 B: 71% smaller.

Read in your browser, never uploaded. Up to 2.0 MB.

Take out

A comment that starts with ! is kept: that is where a licence goes. Titles and descriptions stay, screen readers use them.

Rounding moves points a little. Compare the two pictures, more so for a small viewBox.

The SVG as it was given
Before
The SVG after optimising
After

Optimised SVG

<svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" viewBox="0 0 96 96"><title>Sun</title><g fill="none" stroke="#e8a317" stroke-width="6" stroke-linecap="round"><circle cx="48" cy="48" r="18" fill="#f6c343"/><path d="M48 8V18M48 78V88M8 48H18M78 48H88M19.716 19.716 26.787 26.787M69.213 69.213 76.284 76.284M19.716 76.284 26.787 69.213M69.213 26.787 76.284 19.716"/></g></svg>
Data URI as

Data URI

data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Ctitle%3ESun%3C/title%3E%3Cg fill='none' stroke='%23e8a317' stroke-width='6' stroke-linecap='round'%3E%3Ccircle cx='48' cy='48' r='18' fill='%23f6c343'/%3E%3Cpath d='M48 8V18M48 78V88M8 48H18M78 48H88M19.716 19.716 26.787 26.787M69.213 69.213 76.284 76.284M19.716 76.284 26.787 69.213M69.213 26.787 76.284 19.716'/%3E%3C/g%3E%3C/svg%3E

In CSS

background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Ctitle%3ESun%3C/title%3E%3Cg fill='none' stroke='%23e8a317' stroke-width='6' stroke-linecap='round'%3E%3Ccircle cx='48' cy='48' r='18' fill='%23f6c343'/%3E%3Cpath d='M48 8V18M48 78V88M8 48H18M78 48H88M19.716 19.716 26.787 26.787M69.213 69.213 76.284 76.284M19.716 76.284 26.787 69.213M69.213 26.787 76.284 19.716'/%3E%3C/g%3E%3C/svg%3E");

For src="…" or url("…"). The SVG namespace is added when it is missing: an image does not show without it.