Learn how to optimise your SVG files for faster-loading websites
Quick Navigation
Learn how to use SVGMaker's SVG Viewer and code editor to optimise your SVG files for faster website performance.
SVG files exported from design tools like Illustrator, Figma, or Inkscape often contain unnecessary code that increases file size. Optimising your SVGs can reduce file sizes by 20-60%, leading to faster page loads and better user experience.
Smaller files mean faster page loads and better user experience.
Page speed is a ranking factor. Optimised SVGs help your SEO.
Save server costs and improve mobile performance.
Easier to read, edit, and maintain your SVG files.
Open your SVG in SVGMaker's SVG Viewer to begin optimising.
Go to the SVG Viewer
Upload your SVG file or paste the SVG code directly
The code appears in the Editor with the live preview on the right
The SVG Viewer uses the same editor as VS Code, so you get syntax highlighting, code folding, and error detection.
The first step is to format messy, minified SVG code for better readability.
Open your SVG in the SVG Viewer
Click the Format button in the toolbar
The code is automatically cleaned up with proper indentation
This uses Prettier to organise your code, making it easier to identify and remove unnecessary elements.
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400"><g><g><circle cx="50" cy="50" r="40" fill="#3B82F6"/></g></g></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400">
<g>
<g>
<circle cx="50" cy="50" r="40" fill="#3B82F6"/>
</g>
</g>
</svg>Now you can clearly see there are unnecessary nested <g> groups that can be removed.
Once your code is formatted, look for elements that can be safely removed.
Remove <g> elements that contain only one child or no children at all.
<!-- Before: Unnecessary wrapper -->
<g>
<circle cx="50" cy="50" r="40" fill="#3B82F6" />
</g><!-- After: Direct element -->
<circle cx="50" cy="50" r="40" fill="#3B82F6" />Check the <defs> section for gradients, filters, or clip paths that aren't referenced anywhere in your SVG.
<!-- Remove if not used -->
<defs>
<linearGradient id="unusedGradient">
<stop offset="0%" stop-color="#fff" />
<stop offset="100%" stop-color="#000" />
</linearGradient>
</defs>Remove tool-specific metadata that browsers don't need:
<!-- Remove these -->
<metadata>...</metadata>
<!-- Illustrator, Inkscape, Figma comments -->
<!-- Generator: Adobe Illustrator 24.0.0 -->Use the live preview to verify your SVG still looks correct after each change.
Path data often contains excessive precision that isn't visible at normal viewing sizes.
Most SVGs don't need more than 1-2 decimal places for coordinates.
<!-- Before: Excessive precision -->
<path d="M10.123456 20.789012 L30.456789 40.123456" /><!-- After: Reduced precision -->
<path d="M10.12 20.79 L30.46 40.12" />For simple shapes, whole numbers often work just as well.
<!-- Before -->
<rect x="10.00" y="20.00" width="100.00" height="50.00" /><!-- After -->
<rect x="10" y="20" width="100" height="50" />Colour values can be shortened without changing the appearance.
<!-- Before -->
fill="#ffffff"
fill="#000000"
fill="#aabbcc"<!-- After -->
fill="#fff"
fill="#000"
fill="#abc"Black fill and stroke are often defaults that don't need to be specified.
<!-- Before: Explicit defaults -->
<path fill="#000000" stroke="none" d="..." /><!-- After: Let defaults apply -->
<path d="..." />When multiple elements share the same styles, consolidate them.
<!-- Before: Repeated styles -->
<circle cx="20" cy="50" r="10" fill="#3B82F6" stroke="#1E40AF" stroke-width="2" />
<circle cx="50" cy="50" r="10" fill="#3B82F6" stroke="#1E40AF" stroke-width="2" />
<circle cx="80" cy="50" r="10" fill="#3B82F6" stroke="#1E40AF" stroke-width="2" /><!-- After: Grouped styles -->
<g fill="#3B82F6" stroke="#1E40AF" stroke-width="2">
<circle cx="20" cy="50" r="10" />
<circle cx="50" cy="50" r="10" />
<circle cx="80" cy="50" r="10" />
</g><style>
.icon { fill: #3B82F6; stroke: #1E40AF; stroke-width: 2; }
</style>
<circle class="icon" cx="20" cy="50" r="10" />
<circle class="icon" cx="50" cy="50" r="10" />A properly set viewBox ensures your SVG scales correctly and doesn't include unnecessary whitespace.
<!-- Before: Large viewBox with small content -->
<svg viewBox="0 0 1000 1000">
<circle cx="100" cy="100" r="50" />
</svg><!-- After: Tight viewBox around content -->
<svg viewBox="25 25 150 150">
<circle cx="100" cy="100" r="50" />
</svg>Adding explicit dimensions helps browsers allocate space before the SVG loads.
<svg width="100" height="100" viewBox="0 0 100 100">
<!-- content -->
</svg>After optimising your SVG code manually, use SVGMaker's export options for additional optimisation.
Click the Download button in the SVG Viewer
Choose your export format
Original unaltered SVG
10-30% smaller file size with automatic optimisation
60-80% smaller using gzip compression
Before exporting your optimised SVG, verify these items:
Follow these guidelines based on your SVG type.
Solutions for common problems you might encounter.
Get support and find answers to your questions
Find answers to frequently asked questions about SVGMaker features and functionality.
Check the full documentation for detailed guides and tutorials.
Contact support through the chatbot for personalized assistance.
Start reducing file sizes and improving your website performance today. Open the SVG Viewer to begin!