SVG Cleanup

js_bits_bill

JS Bits Bill

Posted on June 30, 2021

SVG Cleanup

Sometimes you'll look inside the markup of an SVG file and you'll see a TON of extra data that is almost definitely superfluous:

svg-source

I came across this great tool called SVGOMG, by Jake Archibald, which lets you easily toggle SVG features like doctype, comments, metadata, etc. to reduce the file size:

svgomg-1

As you toggle options you'll see how much savings the new file will have. When you're done you'll be able to copy or download the smaller output:

svgomg-2

I particularly love the realtime preview the tool has so you can see how the quality stays as you toggle options. And it's also great for devs like me who have OCD about unnecessary code! 🧼

Here's a quick video of how to use it:


SVG cleanup


Check out more #JSBits at my blog, jsbits-yo.com. Or follow me on Twitter and TikTok.

💖 💪 🙅 🚩
js_bits_bill
JS Bits Bill

Posted on June 30, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

External SVGs that you can style
javascript External SVGs that you can style

April 11, 2022

SVG Cleanup
javascript SVG Cleanup

June 30, 2021

How SVGs can be dangerous 👿
javascript How SVGs can be dangerous 👿

August 7, 2020

Fluid SVGs with Vue.js
vue Fluid SVGs with Vue.js

March 9, 2018