Home › Image Tools › SVG Optimizer

SVG Optimizer

Paste SVG code or drop SVG files to make them smaller. The optimizer removes metadata, comments and Inkscape, Illustrator, Sketch and Figma leftovers, rounds coordinates, compacts path data and collapses whitespace, then shows the size saved and a side-by-side preview so you can check nothing changed.

Original0 B
Optimized0 B
Saved0%
Gzipped–
Preview
Original SVG
Original
Optimized SVG
Optimized
Options
Advertisement
Advertisement

How to use the SVG Optimizer

  1. Add your SVG: paste the code into the Input box, or drop or choose one or more .svg files. A sample is loaded so you can see the result first.
  2. Review the options. The defaults are safe for almost every file; choose a lower number precision for smaller files or Keep for exact coordinates.
  3. Check the preview: the original and optimized images are shown side by side, and the visual check reports whether they look identical.
  4. Copy or download the optimized SVG. With several files, click Download all (ZIP).

What the optimizer removes and changes

OptionBeforeAfter
XML declaration & doctype<?xml version="1.0"?><!DOCTYPE svg ...>removed (not needed by browsers)
Editor datainkscape:label="Layer 1", <sodipodi:namedview>, sketch:typeremoved
Number precision (3)x="20.000000" r="12.500000"x="20" r="12.5"
Compact path dataM 100.00000,48.000000 L 152.00000,92.000000 L 140,92M100 48L152 92 140 92
Shorten colors#FFFFFF, rgb(255,0,0)#fff, #f00
Unused IDs<rect id="rect833"> never referenced<rect>
Empty groups<g id="g841"></g>, <g> without attributesremoved or unwrapped
Width/height (optional)width="200" height="200" viewBox="0 0 200 200"viewBox="0 0 200 200"

How rounding stays accurate

Paths often use relative commands such as l 10.333 0, where each point is measured from the previous one. Rounding every step on its own lets tiny errors add up along a long path, so shapes can drift or fail to close. This optimizer tracks the exact position and the rounded position as it goes and rounds each relative step so that the rounded path always lands on the correctly rounded absolute point. The result is within half of the last kept decimal everywhere, no matter how long the path is.

Precision is counted in user units of the viewBox. With a 24 × 24 icon, 3 decimals means accuracy to 1/1000 of a unit, far below one screen pixel. With a viewBox of 0 0 1 1 each unit is the whole image, so keep 4 or more decimals.

What is kept on purpose

  • Text content inside <text>, <tspan>, <title> and elements with xml:space="preserve", including spaces.
  • Referenced IDs: gradients, patterns, clip paths, masks, filters, markers, <use> targets, animation triggers and IDs mentioned in CSS. IDs on <symbol> elements are always kept so SVG sprite sheets still work.
  • Accessibility: <title>, <desc> and aria-* attributes stay unless you choose to remove titles.
  • Scripts: when an SVG contains a script, IDs are not removed, because the script might look elements up by ID.

Frequently asked questions

How much smaller will my SVG get?

It depends on where the file came from. SVGs exported from Inkscape, Illustrator or Sketch often shrink by 30 to 70 percent because they contain editor metadata and long decimals. Files that were already minified may only shrink by a few percent.

Will optimizing change how my SVG looks?

With the default settings, no visible change is expected. Numbers are rounded to 3 decimal places and relative path coordinates are corrected so rounding errors do not add up. The tool renders both versions and compares their pixels so you can confirm the result looks identical; if you see a difference, raise the precision or choose Keep.

What precision should I use?

Use 3 for most icons and illustrations and 1 or 2 for large artwork measured in hundreds of pixels. Tiny viewBoxes, for example 0 0 1 1, need more digits, so choose 4, 5 or Keep.

Why keep the viewBox but remove width and height?

Without fixed width and height attributes, the SVG scales to the size of its container in CSS, which makes it responsive. The viewBox keeps its proportions. If the file has no viewBox, the tool creates one from the width and height before removing them.

Is it safe to remove IDs?

Only IDs that nothing references are removed. IDs used by gradients, clip paths, masks, use elements, animations or CSS rules are kept, IDs on symbol elements are always kept for sprite sheets, and no IDs are removed when the file contains a script.

Should I also gzip my SVG?

Yes. Web servers usually send SVG compressed with gzip or Brotli, which typically shrinks it a further 60 to 80 percent. The tool shows the gzip size so you can see what visitors actually download.

Are my files uploaded?

No. Everything runs in your browser with JavaScript, so your SVG files never leave your device.

Related tools

SVG to PNGConvert SVG graphics to PNG or JPEG at any scale.PNG to SVG ConverterConvert PNG or JPG images to scalable SVG vectors with color and detail control.Seamless Pattern GeneratorMake seamless dot, stripe, wave, grid, zigzag and check patterns. Export CSS, SVG or PNG.HTML MinifierMinify HTML: strip comments and whitespace safely and see how many bytes you save.Background RemoverRemove image backgrounds automatically with AI.Make Image TransparentRemove a white or solid-color background and save a transparent PNG, right in your browser.Image to Text (OCR)Extract text from images, screenshots and photos with OCR in 25+ languages, right in your browser.Image CompressorShrink images to a target size like 100 KB.Image ResizerResize images to any size without losing quality.Compress Image to 20KBShrink any photo to under 20KB (or any target size).Compress Image to 100KBShrink any photo to under 100KB automatically, with the best quality that fits.Compress JPEG to 50KBShrink photos to under 50KB for forms, passports and exams.HEIC to JPGConvert iPhone HEIC photos to JPG.WEBP to JPGConvert WEBP images to JPG in bulk.PNG to JPGBatch convert PNG images to JPG with a background color.JPG to PNGBatch convert JPG images to PNG.Image CropperCrop images, including circle crops for profile pictures.Rotate & Flip ImageRotate images by any angle or mirror them, one or many at once.Meme GeneratorMake memes with classic templates and custom text.Collage MakerCombine photos into a grid collage.Add Watermark to PhotoAdd a text or logo watermark to one or many photos at once.Blur Image & Face Pixelate ToolBlur or pixelate faces, plates and backgrounds in a photo.Pixelate Image & Pixel Art ConverterTurn any picture into pixel art with retro palettes and dithering.Logo MakerDesign a text logo with fonts, icons and colors, then save SVG or PNG.Certificate MakerDesign certificates from templates and export one or many as PDF.WEBP to PNGConvert WEBP images to PNG, keeping transparency.PNG to ICOCreate multi-size favicon .ico files from PNG.GIF MakerTurn videos and images into GIFs, trim and compress.Business Card MakerDesign business cards and download a print-ready PDF.Flyer MakerDesign printable and social media flyers from free templates.Poster MakerDesign posters in A0–A5 and US sizes and download a print-ready PDF.Invitation Card MakerCreate printable birthday, wedding and party invitations for free.Color Palette GeneratorGenerate beautiful color palettes and export them.HEX to RGBConvert HEX colors to RGB and other formats.RGB to HEXConvert RGB to HEX with sliders, live swatch and one-click copy.HEX to HSLConvert HEX colors to HSL and back with interactive sliders.RGB to CMYK ConverterConvert RGB and HEX colors to CMYK for print, and back.Color Contrast CheckerCheck WCAG contrast ratios and find accessible text colors.Pantone to HEXLook up approximate HEX, RGB and CMYK values for Pantone colors.Color Name FinderFind the closest color name for any HEX or RGB color.AVIF to JPGConvert AVIF images to widely supported JPG.PNG & JPG to WEBPConvert PNG and JPG images to smaller WEBP files.Aspect Ratio CalculatorCalculate image sizes for 16:9, 4:3 and any ratio.Thumbnail Safe ZonePreview YouTube and TikTok thumbnail safe zones.Color Blindness SimulatorSee any image as people with protanopia, deuteranopia, tritanopia or achromatopsia see itAdd Text to ImageAdd styled text layers with outline and shadow to any photo, then downloadThumbnail MakerDesign 1280×720 YouTube thumbnails with templates, bold text and stickersImage Color PickerPick any pixel colour from an image and get HEX, RGB, HSL plus a paletteImage Border AdderAdd a border, rounded corners, matte and shadow to a photo onlineWallpaper GeneratorCreate gradient and pattern wallpapers sized for any phone, tablet or desktopColor Shades GeneratorTurn one HEX color into a 50-950 scale plus tints, shades and tones, ready to export.Round Corners ImageGive any picture rounded, circle or squircle corners and save a transparent PNG.Printable Calendar MakerMake a printable month or year calendar with holidays, then print or save PDF.YouTube Thumbnail GrabberPaste a YouTube link to get every thumbnail size, from HD 1280x720 down to 120x90.Tailwind Color GeneratorTurn one color into a full Tailwind 50–950 shade scale and export the config or CSS.Image Flipper & MirrorMirror photos horizontally or flip them vertically, one image or a whole batch.Printable Planner GeneratorDesign daily or weekly planner pages with your dates and colors, then print them as a PDF.CSS Gradient GeneratorDesign linear, radial and conic CSS gradients with draggable stops and export CSS or PNG.Grayscale Image ConverterTurn color photos into black and white with luma, luminance or average methods and sepia.Graph Paper GeneratorMake printable square, dot, isometric or hex graph paper and download it as PDF, PNG or SVG.Color MixerMix two colors in sRGB, linear, OKLab or OKLCH, or blend them with Photoshop-style modes.Photo FiltersApply 27 one-click photo filters like Vintage, Noir and Teal & Orange with an intensity slider.Lined Paper GeneratorCreate printable lined paper: wide, college or handwriting ruling, Cornell notes, PDF or PNG.Random Color GeneratorGenerate random HEX colors one at a time or in batches, with hue, saturation and lightness ranges.Photo EditorEdit photos online: brightness, contrast, saturation, crop, rotate, flip and filters with undo.Chart MakerMake bar, line, area, pie and doughnut charts from a simple table and download PNG or SVG.Color WheelFind complementary, triadic, analogous and other color harmonies on an interactive wheel.Image SharpenerSharpen soft or slightly blurry photos with a real unsharp mask and before/after view.Venn Diagram MakerMake 2- or 3-circle Venn diagrams from lists; overlaps are found for you. Export PNG or SVG.Invert Image ColorsTurn any picture into a color negative, with R/G/B channel toggles and an intensity slider.Mind Map MakerBuild mind maps fast with keyboard shortcuts and auto layout, then export PNG, SVG or JSON.Image SplitterSplit an image into a rows × columns grid of tiles and download them one by one or as a ZIP.Org Chart MakerType an indented list of names and titles and get a clean org chart to download as PNG or SVG.Image CombinerCombine images side by side, stacked or in a grid, with spacing, background color and alignment.Timeline MakerCreate horizontal or vertical timelines from dated events with colors, then save PNG or SVG.Screenshot BeautifierPut screenshots on gradient backgrounds with padding, rounded corners, shadow and a browser frame.Gantt Chart MakerPlan tasks with dates, progress and dependencies on a Gantt chart, then export PNG or CSV.Image UpscalerEnlarge images 2×, 3× or 4× with Lanczos-3 or bicubic resampling and optional sharpening.Word Cloud GeneratorTurn any text into a word cloud in shapes like a heart or star, then save it as PNG or SVG.Image Metadata ViewerSee a photo's EXIF data: camera, lens, exposure, date and GPS location, then strip it in one click.Pie Chart MakerMake pie and donut charts with labels, percentages and a legend, then download PNG or SVG.Favicon GeneratorMake a favicon.ico, PNG icons, apple-touch-icon and web manifest from an image, text or emoji.Color PickerPick any color and get HEX, RGB, HSL, HSV and CMYK codes, shades and a screen eyedropper.HTML Color CodesAll 140 HTML color names with HEX and RGB codes, plus the 216 web-safe colors. Click to copy.Passport Photo MakerMake passport and visa photos for any country and print them on a 4x6 sheet.EXIF RemoverRemove EXIF, GPS location and other metadata from JPG, PNG and WEBP photos.Image DPI ChangerChange the DPI of JPG and PNG images without re-encoding, and see the print size.Online PaintDraw and paint in your browser: brushes, shapes, fill bucket, text, undo and PNG export.Signature MakerDraw or type your signature and download it as a transparent PNG or SVG.Color Palette from ImageExtract the main colors of any photo as HEX codes, CSS variables and a palette PNG.Photo to SketchTurn any photo into a pencil, charcoal or color sketch in your browser and download it.Image ConverterConvert images between JPG, PNG, WEBP, AVIF, BMP, GIF and ICO in batches, right in your browser.HEIC to PNGConvert iPhone HEIC and HEIF photos to lossless PNG in batches, with ZIP download.GIF Frame ExtractorSplit an animated GIF into PNG frames with delays, a sprite sheet and ZIP download.GIF to MP4Convert animated GIFs to MP4 video with loops, scaling and background color, in your browser.ICO to PNGExtract every size from ICO and CUR icon files and save them as PNG images or a ZIP.Pixel Art MakerDraw pixel art on an 8 to 64 px grid with palettes, fill and mirror, then export PNG or SVG.Quote Image MakerTurn a quote into a shareable image for Instagram, Stories or X with backgrounds and fonts.Social Media Image ResizerResize photos for Instagram, Facebook, X, LinkedIn, YouTube, TikTok and Pinterest in one go.Profile Picture MakerMake a round or square profile picture with a ring border and color or gradient background.Before and After Image MakerCombine two photos into a labeled before and after image or an animated slider video.Image Diff CheckerCompare two images and highlight every changed pixel, with % difference and a swipe slider.Photo Frame MakerPut photos in polaroid, film strip, gallery, rounded or shadow frames with a caption.Device Mockup GeneratorPut a screenshot into a phone, tablet, laptop, monitor or browser frame and download a PNG.Replace Color in ImageClick a color in a picture and swap it for a new color or transparency, keeping the shading.Duotone GeneratorTurn any photo into a bold two-color duotone image with presets, custom colors and intensity.Glitch Image EffectAdd RGB split, scanlines, slice shifts and noise to a photo for a digital glitch look.Emoji to ImageTurn any emoji into a PNG image from 64 to 1024 px, transparent or on a color, in batch.Text to ImageTurn text into a PNG image with your font, size, colors, padding, alignment and wrapping.Compress Image to 200KBShrink any photo to under 200KB automatically, with the best quality that fits.CMYK to RGBConvert CMYK percentages to RGB and HEX color codes with sliders and a live preview.HSL to HEXConvert HSL and HSLA colors to HEX and RGB with sliders and a live preview.HEX to RGBAConvert HEX color codes to CSS rgba() with an opacity slider and one-click copy.RGBA to HEXConvert rgba() colors to 8-digit HEX, or flatten transparency onto any background.HEX to CMYKConvert HEX color codes to CMYK percentages for print, with a live preview.