SVG Optimiser — Paste Code Directly, Size Reduction %
Paste SVG code directly into the editor or upload an SVG file. Furthermore, the optimiser removes XML comments, excessive whitespace, empty elements, redundant attributes, hidden layers and editor metadata — typically achieving 30–60% size reduction. The size reduction percentage and character count display in the stats strip before downloading.
How to use the SVG Optimiser
Paste SVG code or upload an SVG file
Click the "Paste SVG code" tab and paste SVG markup directly into the editor. Furthermore, switch to the "Upload SVG file" tab to load an .svg file from disk — the file content loads into the input field automatically. Both modes feed the same optimiser.
Choose optimisation options and run
Four options control which optimisations apply — Remove comments, Collapse whitespace, Remove hidden elements and Strip editor metadata. Furthermore, all four are enabled by default. Click Optimise SVG to process the source code.
Review the reduction and download
The stats strip shows original character count, optimised character count and percentage reduction. Furthermore, the SVG preview confirms the optimised code renders correctly. Copy the optimised code directly or download as an .svg file.
What each optimisation option removes
Each option targets a different category of non-visual SVG overhead. Furthermore, combining all four produces the maximum size reduction while preserving all visible content.
| Option | Removes | Typical impact |
|---|---|---|
| Remove comments | XML comment blocks <!-- … --> | 5–15% reduction |
| Collapse whitespace | Newlines, indentation, extra spaces | 15–30% reduction |
| Remove hidden elements | display:none and visibility:hidden elements | 5–20% reduction |
| Strip editor metadata | Inkscape, Illustrator, Sketch namespaces and metadata | 10–25% reduction |
How SVG optimisation reduces file size
The optimiser applies a sequence of text transformations to the SVG source string. Furthermore, each transformation targets specific content patterns using regular expressions.
Whitespace: /\s+/g → single space; > < → >< (no spaces at tag boundaries)
Editor meta: sodipodi:, inkscape:, dc:, cc:, rdf: namespaced elements removed
Worked example: optimising an Inkscape SVG icon
A developer exports an SVG icon from Inkscape and needs to embed it in a React component. The exported file is 4.2 KB. After optimisation:
What is SVG optimisation?
SVG (Scalable Vector Graphics) files contain both visual content — paths, shapes, gradients — and non-visual overhead added by the authoring software. Furthermore, editors like Inkscape, Adobe Illustrator and Figma embed their own namespace metadata, layer structure comments, version information. Coordinate precision beyond what is needed for display. An SVG icon exported from Inkscape may contain 40–60% non-visual overhead that has no effect on the rendered image. Moreover, removing this overhead reduces file size. Changing any visual property — the browser renders the optimised SVG identically to the original.
SVG optimisation matters most for SVGs embedded in web pages — icons, logos and UI graphics. A 5 KB icon used 20 times adds 100 KB of SVG code to the page. Moreover, SVGs served as separate files benefit from browser caching,. Inline SVGs optimised to minimum size provide the best combination of instant render and small payload.
Why paste mode matters more than upload
Most SVG optimiser tools require uploading a file and downloading the result. Furthermore, web developers embedding SVG icons in HTML or React have no separate file — the SVG code lives within the source file. Paste mode copies the SVG tag, optimises it and copies the result back — entirely within the browser. Moreover, paste mode also enables optimising SVG code from any source — CSS background-image data URLs, API responses containing SVG strings and generator output — without creating an intermediate file.
Why SVG size matters for web performance
SVG files inline in HTML are parsed as part of the DOM — every element creates a DOM node that the browser's layout engine must process. Furthermore, an unoptimised SVG icon with 200 Inkscape metadata elements creates 200 unnecessary DOM nodes per page. Removing these elements reduces memory usage and parsing time. Moreover, Google Lighthouse flags large inline SVGs as render-blocking resources — optimising SVGs to minimum size reduces Time to Interactive scores by eliminating unnecessary DOM complexity.
Frequently asked questions
Related tools
Image to Base64
Encode the optimised SVG as a base64 data URL. Furthermore, CSS and HTML snippets generate automatically.
Image Compressor
Compress raster images embedded in SVG. Furthermore, target file size mode hits exact KB limits.
Image Format Converter
Convert SVG exports to raster formats. Furthermore, JPG, PNG and WebP output available.
Image Colour Picker
Sample colours from SVG previews. Furthermore, HEX, RGB and HSL values all shown.
Favicon Generator
Convert SVG icons to favicon ICO files. Furthermore, multi-size ICO and live tab preview.
Image Border / Frame Adder
Add frames to rasterised SVG exports. Furthermore, solid, gradient and shadow styles.