Command count
--
Free · Instant · No signup
Count path commands, measure string length, and strip extra spaces from a d attribute.
Page updated 2026-09-04.
Command count
--
Original length
--
'M 10 10 L 90 10 L 50 80 Z' (25 characters, 4 commands: M, L, L, Z) compacts to 'M10 10L90 10L50 80Z' -- identical drawing instructions, with unnecessary spaces between commands and coordinates removed.
This works because SVG path syntax doesn't require a space between a command letter and its following number -- 'M10' is parsed identically to 'M 10', so removing that space changes nothing about how the path renders, only how many characters it takes to describe it.
For a small triangle path like this example, the savings are modest (25 to 20 characters), but the same whitespace-removal technique applied across a complex icon set with many paths, or a detailed illustration with hundreds of path commands, can meaningfully reduce total file size.
Whitespace compact only. Coordinate rounding and command merging are not applied. Two further optimizations this tool doesn't perform: rounding coordinates to fewer decimal places (a path using 6 decimal places of precision when 2 would be visually indistinguishable wastes characters), and merging or simplifying redundant consecutive commands where possible -- both are common techniques in dedicated SVG optimization tools like SVGO.
This tool only removes whitespace -- it doesn't validate that the path syntax itself is well-formed, so a malformed or invalid path string would compact (or fail to compact meaningfully) without being flagged as broken.
Command count (4 here) is a useful proxy for path complexity -- a path with dozens of commands is meaningfully more complex to both render and maintain than one with a handful, independent of how compactly it's written.
For a more thorough optimization pass (coordinate rounding, redundant command removal, and more) beyond simple whitespace compacting, the SVG Optimizer & Minifier Tool is the more complete option.
If the SVG contains embedded scripts or event handlers that need removing for safety (a different concern from file size), the SVG Icon Sanitizer addresses that separately.
SVG path syntax doesn't require a space between a command letter and the number that follows it -- 'M10 10' and 'M 10 10' parse to the exact same instruction, so removing that space changes nothing about the rendered shape.
No, whitespace compacting is purely a text-size optimization -- it doesn't touch the actual coordinate values or commands, so the rendered shape is pixel-for-pixel identical before and after.
No. Whitespace compact only. Coordinate rounding and command merging are not applied. Reducing coordinate precision (rounding 10.123456 to 10.12, for example) is a separate optimization technique this simplified tool doesn't perform.
For a small, simple path like this example, the savings are modest. The technique scales better applied across many paths or a complex illustration with hundreds of commands, where accumulated whitespace adds up to a more meaningful percentage of total file size.
No. Whitespace compact only. Coordinate rounding and command merging are not applied. It only removes whitespace from whatever text you provide -- it doesn't check whether the path commands and coordinates form valid, well-formed SVG path syntax.
Random API Key & Secret Token Generator Generate a hex or base64url token from crypto.getRandomValues.
CSS Box-Shadow Generator Live preview and copy-ready CSS.
JSON to YAML Converter Validate JSON in the browser and dump YAML with 2 or 4 space indent.
Hash Generator (MD5, SHA-1, SHA-256, SHA-512) Hash text to hex with SHA-1 / SHA-256 / SHA-512 via SubtleCrypto, plus a compact MD5.