SVG Precision Cleaner
Reduce unnecessary decimal precision while preserving visual fidelity.
SVG precision cleanup
Clean SVG decimal precision — reduce coordinate noise, preserve visual fidelity.
Paste SVG code, upload a file or try the built-in sample. The precision engine parses the SVG as a DOM tree and rounds numbers only in safe numeric contexts: path coordinates, transform values and numeric presentation attributes. IDs, colors, references and text content are never touched. Everything runs locally — your files are not uploaded.
Please check the SVG markup and try again.
Original vs cleaned SVG preview
Paste SVG markup or try the sample to preview the source.
Click Clean Precision to preview the result.
SVG markup
Paste a complete SVG document or inline SVG element. The precision engine will scan path data, transforms and numeric attributes.
Cleaned SVG
The precision-cleaned SVG markup appears here after clicking Clean Precision. Copy or download using the buttons in the Settings panel.
How It Works
SVG Precision Cleaner parses the SVG markup into a DOM tree using the browser's built-in DOMParser, then walks every element and inspects each attribute individually. For path data (d attribute), transform attributes and a defined set of numeric SVG presentation attributes, it applies a number-aware tokeniser that extracts each floating-point value, rounds it to the chosen number of decimal places, optionally removes trailing zeros, and writes the rounded value back. Inline style declarations are parsed by CSS property name — only recognized numeric SVG properties such as opacity, stroke-width and stroke-dasharray are touched. Attributes that carry non-numeric data — id, class, href, fill, stroke, color values, url() references, CSS variables, base64 data URIs, aria labels and text content — are never inspected for numbers. The result is serialised back with XMLSerializer and shown in the preview alongside the original. All processing runs in your browser with no upload.
Use Cases
- Reducing path coordinate verbosity in SVG exports from design tools such as Figma or Illustrator, where exported coordinates often carry five or six unnecessary decimal places
- Shrinking SVG file size before shipping to production when a full SVGO optimization pass is not required or desired
- Cleaning up transform and viewBox values in hand-edited SVGs that have accumulated precision noise from copy-paste or script generation
- Preparing SVG files for diffing or version control by normalizing numeric precision across files so minor floating-point differences do not inflate diffs
- Reducing stroke-dasharray, opacity and other numeric attribute noise in SVG animation files without touching keyframe values or timing functions
FAQ
Which SVG attributes does SVG Precision Cleaner modify?
The cleaner modifies three categories of content: path d attributes (all coordinate and command numbers), transform, gradientTransform and patternTransform attributes (all numeric arguments to translate, rotate, scale, matrix, skewX and skewY), and a defined set of numeric SVG presentation attributes including x, y, cx, cy, r, rx, ry, width, height, opacity, fill-opacity, stroke-opacity, stroke-width, stroke-dasharray, stroke-dashoffset, viewBox, points, offset and others. Inline style declarations are parsed by CSS property name and only numeric SVG properties are cleaned.
What is never modified?
The cleaner never modifies: id and class attributes, href and xlink:href references, fill, stroke and color attributes (which carry color values, not coordinates), url(#...) references in any attribute, CSS variables such as var(--spacing), base64 data URIs, aria-label and other accessibility attributes, data-* custom attributes, and text node content inside SVG elements.
Will precision cleaning break gradients, filters or masks that use id references?
No. The cleaner skips all attributes that carry id references — fill, clip-path, mask, filter, marker-start, marker-mid, marker-end and href. The id attribute itself is never touched. Gradient stop positions (offset attribute) are cleaned as they are pure numbers on a 0–1 scale, but the gradient id and its url() references remain exactly as they are.
Why does my SVG look slightly different after cleaning at low precision?
Reducing precision below 2 decimal places can shift path coordinates by up to half a unit in each direction. For most screen-rendered SVGs this is invisible, but for complex paths with many closely-spaced points, or for SVGs viewed at very large sizes, rounding to 0 or 1 decimal can introduce visible shape changes. Use the side-by-side preview to compare before downloading, and consider 2 decimals as the safe default.
Does SVG Precision Cleaner upload my file?
No. All processing runs entirely in your browser using the DOMParser and XMLSerializer APIs. Your SVG file is never sent to any server.
What does Preserve Tiny Values do?
When enabled, any number whose absolute value is greater than zero but less than 0.0001 is left unchanged. This prevents tiny but meaningful values — such as a very small opacity, a sub-pixel stroke offset or a near-zero coordinate — from being rounded to zero and inadvertently removed from the output.