# SVG optimizer

> Minify an SVG, compare the size, and keep the viewBox unless you turn that off.

Free SVG optimizer. SVGO runs in this browser: comments, metadata, and extra precision come out, and you can turn each pass off. The viewBox stays unless you remove it. The file is not uploaded.

- Page: https://benchline.fabwaseem.com/t/svg-optimizer
- Runs: in the browser. Input stays on the device.
- Price: free, no account
- Input: SVG markup, a decimal precision, and optional passes such as removing the viewBox.
- Output: Minified SVG markup and the size before and after.
- Keywords: svg optimizer, svgo online, minify svg
- Updated: 2026-10-18
- Built by: Waseem Anjum (https://fabwaseem.com)

## How to use it

1. **Paste or drop the SVG.** Add the markup. The original size is counted in bytes.
2. **Choose the passes.** Leave the viewBox on. Turn off a pass if it changes something you need.
3. **Copy or download.** Save the smaller file and check the preview.

## Use it from an AI agent

MCP tool name: `optimize_svg`
MCP endpoint: https://benchline.fabwaseem.com/mcp (Streamable HTTP, no key)
HTTP: POST https://benchline.fabwaseem.com/api/v1/tools/svg-optimizer with the input as the JSON body
This call fetches a public URL on the server. Private addresses are refused.

Minify an SVG with SVGO. Send markup or a file as base64 or a public URL. Private addresses are refused and the file is capped at 10 MB. The viewBox is kept unless removeViewBox is true. Returns the optimized markup and the byte counts.

### Input schema

```json
{
  "type": "object",
  "properties": {
    "svg": {
      "description": "SVG markup. Provide svg or file.",
      "type": "string"
    },
    "file": {
      "description": "An SVG file. Provide svg or file.",
      "type": "object",
      "properties": {
        "url": {
          "description": "Public http or https URL. Private and local addresses are refused.",
          "type": "string"
        },
        "data": {
          "description": "Base64 bytes or a data URI. Decoded size is capped at 10 MB.",
          "type": "string"
        },
        "mimeType": {
          "description": "MIME type when you know it.",
          "type": "string"
        },
        "filename": {
          "description": "File name, including the extension when you have one.",
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "precision": {
      "default": 3,
      "type": "integer",
      "minimum": 0,
      "maximum": 8
    },
    "removeViewBox": {
      "default": false,
      "type": "boolean"
    },
    "removeDimensions": {
      "default": false,
      "type": "boolean"
    }
  },
  "required": [
    "precision",
    "removeViewBox",
    "removeDimensions"
  ],
  "additionalProperties": false
}
```

### Example tools/call

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "optimize_svg",
    "arguments": {
      "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"10\" viewBox=\"0 0 10 10\"></svg>",
      "precision": 3,
      "removeViewBox": false,
      "removeDimensions": false
    }
  }
}
```

Setup for Claude, Cursor, and VS Code: https://benchline.fabwaseem.com/mcp/guide

## Questions

### Is the SVG uploaded?

No. SVGO runs in this browser.

### Will the viewBox be removed?

Not unless you turn that on. Removing the viewBox can change how the SVG scales.

### What does precision do?

It sets how many decimal places path and transform numbers keep. Lower numbers are smaller and less exact.

### Are scripts removed?

Yes. Script elements are always removed.

## Related tools

- [Image compressor](https://benchline.fabwaseem.com/t/image-compress): Shrink JPEG, PNG, WebP, and AVIF in the browser, with the real before and after size.
- [Favicon generator](https://benchline.fabwaseem.com/t/favicon-generator): Make the ICO, the PNG sizes, the manifest, and the HTML snippet from a picture or letters.
- [Color converter](https://benchline.fabwaseem.com/t/color-converter): Turn any color into HEX, RGB, HSL, OKLCH, and CMYK, and check the contrast ratio.
- [Image format converter](https://benchline.fabwaseem.com/t/image-convert): Convert HEIC, WebP, PNG, JPG, and AVIF in the browser. Nothing is uploaded.
