SVG to ICO API
POST an SVG to /v2/convert/svg/to/ico to get an icon file holding one image. Pick its size with ImageWidth: the sample asks for 64 and gets a 64 × 64 icon of 3,918 bytes. Without a size, drawings larger than 256 px are fitted to 256 × 256.
- Endpoint
- POST /v2/
convert/ svg/ to/ ico - Accepts
- svg
- Sample timing
- 3 ms median of 5 runsHow we measure
- Request size
- Up to 10 MB on the Free plan or 100 MB on paid plans, all files together
Request and response
Every sample below ran against the API before this page was published. Set PDFCONVERSIONAPI_KEY to your key and run it as is.
curl -sS -X POST \
https://api.pdfconversionapi.com/v2/convert/svg/to/ico \
-H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
-F File=@water-day-icon.svg \
--form-string ImageWidth=64 \
-o response.json
# FileData is base64. Save the first file in converted/,
# or print the JSON error.
if jq -e '.Files' response.json > /dev/null; then
mkdir -p converted
name=$(jq -r '.Files[0].FileName' response.json)
jq -r '.Files[0].FileData' response.json \
| base64 --decode > "converted/$name"
else
cat response.json
fiimport base64
import os
import requests
key = os.environ["PDFCONVERSIONAPI_KEY"]
response = requests.post(
"https://api.pdfconversionapi.com/v2/convert/svg/to/ico",
headers={"Authorization": f"Bearer {key}"},
files=[("File", open("water-day-icon.svg", "rb"))],
data={
"ImageWidth": "64",
},
timeout=180,
)
result = response.json()
if not response.ok:
raise SystemExit(f"{result['Code']}: {result['Message']}")
os.makedirs("converted", exist_ok=True)
for file in result["Files"]:
path = os.path.join("converted", file["FileName"])
with open(path, "wb") as out:
out.write(base64.b64decode(file["FileData"]))
print(path, file["FileSize"], "bytes")
import { mkdir, readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
const form = new FormData();
const file = "water-day-icon.svg";
form.append("File", new Blob([await readFile(file)]), file);
form.append("ImageWidth", "64");
const url = "https://api.pdfconversionapi.com/v2/convert/svg/to/ico";
const key = process.env.PDFCONVERSIONAPI_KEY;
const response = await fetch(url, {
method: "POST",
headers: { Authorization: `Bearer ${key}` },
body: form,
});
const result = await response.json();
if (!response.ok) {
throw new Error(`${result.Code}: ${result.Message}`);
}
await mkdir("converted", { recursive: true });
for (const file of result.Files) {
const path = join("converted", file.FileName);
await writeFile(path, Buffer.from(file.FileData, "base64"));
console.log(path, file.FileSize, "bytes");
}
{
"ConversionCost": 1,
"ConversionTime": 0.003,
"Files": [
{
"FileName": "water-day-icon.ico",
"FileExt": "ico",
"FileSize": 3918,
"FileData": "AAABAAEAQEAAAAAAIAA4DwAA…"
}
]
}Response from our test run on 2026-11-03. ConversionTime shows the median of 5 runs. FileData is shortened here; the real response carries the whole file as base64.
The sample, converted
The same file the code sends. Download the input and the output and compare them yourself.

- Input
- water-day-icon.svg (2.1 KB)
- Output
- water-day-icon.ico (3.8 KB)
- Source
- An app icon for a fictional plant-watering reminder, with two gradients, a soft drop shadow and a text label, which we drew by hand. (CC0-1.0). How it was made
- Made by
- 2026-11-04, API build
9eeeb0640aba
Parameters
Send these as form fields next to the file. Names are case-insensitive. If you set one of the documented options below that we don't support yet, the request fails with a 400 that names it instead of returning a file made without it.
| Parameter | What it does |
|---|---|
ImageWidthinteger | Icon width in pixels. The SVG is rendered at that size, then reduced to fit 256 × 256 if it is larger. 32 gave a 1,504-byte icon, 64 one of 3,918 bytes.Values: 1–20000 |
ImageHeightinteger | Icon height in pixels, with the width derived from the drawing.Values: 1–20000 |
ScaleProportionsboolean, default true | false stretches into both sizes. 300 × 150 then became a 256 × 128 icon after the fit. |
ScaleIfLargerboolean, default false | true makes the size a ceiling and never enlarges the SVG's own pixel size. |
ScaleImageboolean, default true | false crops a top-left region instead of scaling. |
ColorSpaceenum, default default | gray and monochrome change the colors; the entry stays 32-bit RGBA. cmyk returns 400.Values: default, rgb, gray, monochrome |
FileNamestring | Name of the icon, favicon for favicon.ico. |
StoreFileboolean, default false | Returns a URL valid for 3 hours instead of the bytes. |
What carries over, and what doesn't
Kept
- Transparency: 496 clear and 815 partly clear pixels in the 64 px icon, the same as the PNG render
- The drawing rendered at the icon size you request (up to 256), not shrunk from a large bitmap
- Proportions when fitting into 256: a 300 × 150 drawing became a 256 × 128 icon
- 8 bits per channel plus alpha, compressed as PNG inside the icon
Lost or not yet supported
- Several sizes in one file: each request makes an icon with one image.
- BMP-style entries: the image inside is PNG data, not a bitmap with an AND mask.
- Sizes above 256 × 256; larger requests are reduced to fit.
TransparentColor,AlphaColorandBackgroundColor, which this route ignores.- Text set in fonts missing from our servers.
Limits
- One SVG per request and one image per icon.
- Requests up to 10 MB on the Free plan or 100 MB on paid plans, all files and fields together.
- The render before the fit counts against the 100,000,000-pixel limit:
ImageWidth=20000returns 413. ImageWidthandImageHeight1 to 20,000; the icon itself is at most 256 × 256.- 120 seconds per conversion; after that, 504.
Where teams use it
favicon.ico from the logo SVG
Generate the favicon in your build from the same SVG the site header uses, at 32 or 48 px, so the two never drift apart.
Icons for Windows programs and shortcuts
Installers and desktop shortcuts take .ico files. Render the 256 × 256 image, the largest one entry can describe, from the vector source.
Questions
Can one .ico hold 16, 32 and 48 px versions?
Not from this route. The icon directory always has one entry. Make one request per size if your program needs several, and combine them with an icon tool.
What happens if I ask for 512 px?
The SVG is rendered at 512 and then reduced to 256 × 256, the largest size an icon entry can state. Without any size, the 300 px sample came back as 256 × 256 (30,341 bytes).
Is the image inside the icon PNG or BMP?
PNG. The icon directory points to data starting with the PNG signature, 32-bit RGBA, for every size we tried, including 32 × 32.
My SVG isn't square. What shape is the icon?
The same shape as the drawing. A 2:1 drawing gives a 256 × 128 icon. For a square icon, make the SVG's viewBox square and center the artwork in it.
Convert your first SVG file in a minute.