SVG Optimizer
Optimize SVG markup online by removing comments, stripping metadata, and adjusting numeric coordinate precision.
Run tool
This online SVG optimizer cleans and shrinks vector graphics markup by stripping unnecessary data and rounding coordinate precision. Upload any valid UTF-8 vector file up to 2 MB to streamline graphic assets for web deployment. The tool parses the root SVG element and strips XML comments and embedded metadata blocks whenever those options remain enabled. It also applies half-even rounding to coordinate values, viewBox definitions, stroke widths, opacities, and unitless dimensions based on your selected decimal precision from 0 to 6 places. Text labels, embedded scripts, interactive event handlers, and values with explicit units remain intact during processing. After running the optimizer, you receive the cleaned markup, a downloadable file, and a concise summary showing original byte count, final byte count, byte difference, and calculated percentage savings. Use this utility to reduce payload sizes for vector icons, logos, and UI illustrations without corrupting valid graphic structures or element hierarchies.
Instructions
- Upload a valid UTF-8 SVG graphic up to 2 MB.
- Choose whether to strip XML comments and metadata tags using the toggle options.
- Set the desired numeric precision from 0 to 6 decimal places (defaults to 2).
- Run the tool to process the markup and inspect the resulting code and byte savings.
- Copy the cleaned markup directly or download the generated SVG file.
Examples
- Optimizing an export from graphic design software: Upload a 45 KB icon containing editor metadata and XML comments, keep both removal toggles enabled, set precision to 2, and receive clean SVG markup with stripped metadata blocks and rounded coordinate attributes.
- Preserving high-precision vector points: Upload an intricate map illustration, uncheck comment removal if annotations are required, and set numeric precision to 4 to round long floating-point coordinates while preserving fine line detail.
FAQ
What happens to embedded scripts and event handlers?
This tool is an optimizer rather than a security sanitizer. It preserves active content such as script tags, links, and event handler attributes outside of removed comment or metadata nodes.
Which numeric values get rounded?
The optimizer rounds viewBox coordinates, unitless position attributes, dimensions, stroke widths, and opacity values. Coordinate strings with explicit units (like px or em) and path data strings remain unchanged.
Why did my file fail to process?
The input must be valid UTF-8 XML with an SVG root element and cannot exceed 2 MB. Files containing document type declarations (DOCTYPE) or XML entity declarations are rejected.
How does numeric rounding handle trailing zeros?
Numbers are rounded using standard half-even rounding to your chosen precision limit, and unnecessary trailing decimal zeros are automatically omitted from the output.