SVG Optimizer and Cleaner

Clean supported SVG markup and inspect input bytes, output bytes and percentage size change.

On-device No sign-up Free to use

Inspect input controls

Showing an example. Edit to see your own.

?

Paste a static SVG or choose a file below. Up to 256 KiB, 2,000 elements and 32 levels. Basic shapes, paths and text only; scripts, CSS, external references, images, use, gradients and filters are refused.

Drop your image here

or choose one from your device

When selected, this file is used instead of the source box.

    ?

    Text, titles, descriptions and xml:space="preserve" content retain their whitespace. Comments and SVG metadata are always removed.

    More options
    ?

    Rounding can change shapes and is off by default. Compare both previews before using the output.

    Processed in your browser. Your inputs stay on this device.

    Result

    Showing an example.

    Remove a comment and structural whitespace while keeping the sample’s coordinates and significant text spacing.

    Cleaned 3 SVG elements: 348 input bytes → 307 output bytes.

    Loading the tool. Your result will appear here.

    https://usefreetools.net/svg-optimizer-cleaner · 20 November 2026

    Was this helpful?

    How to use SVG Optimizer and Cleaner

    1. Paste a supported static SVG or choose one SVG file. A chosen file replaces the source box.
    2. Choose whether to remove whitespace between shapes. Keep every coordinate unless rounding is intentional; comments and SVG metadata are removed in either case.
    3. Compare the baseline and cleaned image previews, input/output byte counts and percentage change. Both previews omit comments and metadata.
    4. Download the cleaned SVG, keeping your original file separately. Review any required attribution or editorial notes before replacing an asset.

    Example: SVG Optimizer and Cleaner

    Remove a comment and structural whitespace while keeping the sample’s coordinates and significant text spacing.

    You add
    SVG source: <svg xmlns="http://www.w3.org/2000/svg" width="320" height="160" viewBox="0 0 320 160"> <!-- A simple local drawing --> <rect x="10.1234" y="10" width="299.8766" height="140" rx="12" fill="#eef2ff" stroke="#334155"/> <text x="28" y="88" font-family="sans-serif" font-size="24" fill="#172033" xml:space="preserve">Keep this text</text> </svg>; Coordinate decimal places: keep; Remove whitespace between shapes: true
    You get
    Cleaned 3 SVG elements: 348 input bytes → 307 output bytes.

    Options

    Supported static drawing
    Basic shapes, paths, groups and text are supported. A selected SVG file takes precedence over pasted text. CSS, gradients, filters, images, use references and other unsupported features are refused.
    Coordinate precision
    Keep every coordinate is the default. Explicit decimal precision can round numeric geometry attributes and change the picture; text content is not rounded. Compare the image previews at a useful scale.
    Whitespace and baseline
    Structural whitespace can be removed while significant text, title, description and xml:space="preserve" content keep their spacing. Comments and metadata are always removed, including from the baseline preview. Keep the original source for those records.

    Supported inputs and limits

    • One supported SVG up to 256 KiB, 2,000 elements and 32 levels.
    • Numeric geometry values must be finite and within ±1,000,000; optional rounding uses 0 to 6 decimal places.
    • Scripts, event attributes, external references, CSS, gradients, filters, images, use references and unsupported constructs are refused.
    • Both exported image previews omit comments and metadata, so the baseline is not an untouched original.
    • Output can grow; a negative percentage means the normalized output is larger.
    More details

    This is a conservative static-subset cleaner, without batch input or general geometry optimization.

    Where your input is processed

    This tool does not upload your inputs. See the limits for anything saved on your device.

    Compare the output before replacing an asset

    Comments and metadata are removed even when coordinate precision is kept. That can matter if the original carried attribution or editorial notes, so retain any information required by the asset’s licence separately. Compare both previews and the actual output; a supported cleanup may produce a larger file and does not certify that an SVG is safe in every application.

    Questions about SVG Optimizer and Cleaner

    Can rounding alter the picture?

    Yes. Precision reduction is an explicit option and needs visual review.

    Will SVG scripts or external resources run?

    No. Unsafe or unsupported constructs are refused before preview.

    Can cleanup increase the file size?

    Yes. Serialization and a small original file can produce a larger result; compare the reported sizes.

    Page updated · Project managed by Tony Hines · Report a problem with SVG Optimizer and Cleaner