Updated November 21, 2026 by Ryan Doyle, who built Pie Chart Generator.
An SVG donut chart is a ring split into arcs, one per value, saved as vector code that stays sharp at any size. Make one below: type or paste your values, set the hole with the slider, and download the .svg. To write one by hand, copy the code further down; the math is worked out for you.
Type, paste two columns, or upload a CSV
Total Value
100
Categories
Manual: Add categories one by one with custom colors
Paste: Copy two columns from Excel or Google Sheets, or type one row per line (Rent, 1200)
CSV: Upload any CSV file with your data
Choose SVG when you download
| Category | Value | Percentage |
|---|---|---|
| Category A | 30 | 30.0% |
| Category B | 25 | 25.0% |
| Category C | 20 | 20.0% |
| Category D | 15 | 15.0% |
| Category E | 10 | 10.0% |
Categories
5
Total Value
100
Chart Type
pie
Slide-ready HD export without watermark
Drop clean 2,712 px PNG or vector SVG straight onto dark or colored slides.
No account required. Instant activation in this browser.
People who make a donut on this site download it as SVG two and a half times as often as people who make a pie. From January 29 to November 20, 2026, 24.1% of the 3,686 donut charts downloaded were .svg files, against 9.6% of 16,112 pies. Donuts were 18.1% of all downloads here but 35% of the 2,537 SVG downloads.
The SVG donuts are small. The median one had 4 segments, and the most common size was two (250 of 887). We don't store what the numbers mean, but two segments is the shape of a progress ring: one share against the rest.
| Chart type | Downloads | As SVG | SVG share |
|---|---|---|---|
| Donut | 3,686 | 887 | 24.1% |
| Pie | 16,112 | 1,539 | 9.6% |
Source: this site's own anonymous download log, January 29 to November 20, 2026, counted by us on November 21, 2026. Editor charts only; no chart contents are stored.
<path> per segment, drawn with two arc commands: along the outside edge, across to the hole, and back along the inside edge. Each segment has a 2-pixel white outline, which is what makes the gaps between colors.<text> elements, so you can restyle or translate them in Figma, Illustrator, Inkscape or a text editor.<title> or <desc>. If you inline it in a web page, add the two lines and role="img" from the code below so screen readers can name the chart.The shortest donut is one stroked circle per value. Give every circle a radius of 15.9155: its circumference is then 2 × π × 15.9155 = 100, so a 30% segment is simply stroke-dasharray="30 70". Each circle's stroke-dashoffset is minus the sum of the segments before it, and rotate(-90 21 21) moves the start from 3 o'clock, where an SVG circle begins, to 12 o'clock.
<svg viewBox="0 0 42 42" width="240" height="240"
role="img" aria-labelledby="donut-title donut-desc">
<title id="donut-title">Visits by source</title>
<desc id="donut-desc">Search 45%, Social 30%, Email 25%</desc>
<g transform="rotate(-90 21 21)" fill="none" stroke-width="6">
<!-- r = 15.9155, so the circumference is 100 -->
<circle cx="21" cy="21" r="15.9155" stroke="#2563EB"
stroke-dasharray="45 55" stroke-dashoffset="0"/>
<circle cx="21" cy="21" r="15.9155" stroke="#16A34A"
stroke-dasharray="30 70" stroke-dashoffset="-45"/>
<circle cx="21" cy="21" r="15.9155" stroke="#B45309"
stroke-dasharray="25 75" stroke-dashoffset="-75"/>
</g>
<text x="21" y="21" text-anchor="middle" dominant-baseline="central"
font-size="7" font-weight="700" fill="#111827">45%</text>
</svg>The code on the left, rendered.
Prefer a round radius such as 16? Add pathLength="100" to each circle instead. MDN describes it as setting the total length the browser uses for distance calculations, so stroke-dasharray is then measured against 100 whatever the radius. The 15.9155 radius does not need the attribute.
With the 15.9155 radius, each segment's dasharray is its share and the rest of 100, and its offset is minus the shares before it:
| Split | Segment 1 | Segment 2 | Segment 3 | Segment 4 |
|---|---|---|---|---|
| 75 / 25 | 75 25, offset 0 | 25 75, offset -75 | - | - |
| 60 / 40 | 60 40, offset 0 | 40 60, offset -60 | - | - |
| 45 / 30 / 25 | 45 55, offset 0 | 30 70, offset -45 | 25 75, offset -75 | - |
| 50 / 30 / 20 | 50 50, offset 0 | 30 70, offset -50 | 20 80, offset -80 | - |
| 40 / 30 / 20 / 10 | 40 60, offset 0 | 30 70, offset -40 | 20 80, offset -70 | 10 90, offset -90 |
// values -> one <circle> per segment (circumference 100)
function donutSvg(rows, { size = 240, ring = 6 } = {}) {
const total = rows.reduce((n, r) => n + r.value, 0);
let start = 0;
const arcs = rows.filter((r) => r.value > 0).map((r) => {
const pct = (100 * r.value) / total;
const circle = `<circle cx="21" cy="21" r="15.9155" stroke="${r.color}"
stroke-dasharray="${pct} ${100 - pct}" stroke-dashoffset="${-start}">
<title>${r.label}: ${pct.toFixed(1)}%</title></circle>`;
start += pct;
return circle;
});
return `<svg viewBox="0 0 42 42" width="${size}" height="${size}" role="img">
<g transform="rotate(-90 21 21)" fill="none" stroke-width="${ring}">
${arcs.join("")}</g></svg>`;
}Each segment carries its own <title>, so hovering it shows the label and share as a native tooltip.
| Method | Best for | Watch out for |
|---|---|---|
| Stroked circles (dasharray) | Hand-written code, progress rings, animating a ring as it fills | Round line caps stick out past each end and overlap the neighbor, so keep stroke-linecap at its default, butt, on multi-segment rings |
| Path arcs (A commands) | Exact filled shapes that design tools treat as ordinary objects; what this site's download uses | More trigonometry; one arc can't draw a full 100% ring because its start and end points match, so split it into two half arcs |
| CSS conic-gradient | A decorative ring in a page's CSS with no SVG at all | Not an SVG: nothing to download or open in a design tool, and no per-segment title or hover |
Labels on the ring. Put each label at its segment's middle angle on the 15.9155 circle, outside the rotated group so the text stays upright. Skip labels on segments under about 5%; there is no room, and the legend covers them.
θ = (start + value / 2) / 100 × 360° − 90° x = 21 + 15.9155 × cos θ y = 21 + 15.9155 × sin θ Social: start 45, value 30 → midpoint 60 → θ = 126° x = 21 + 15.9155 × (−0.588) ≈ 11.6 y = 21 + 15.9155 × 0.809 ≈ 33.9
stroke-dasharray="29 71" with stroke-dashoffset="-45.5".stroke-dasharray="100 0", which draws the whole ring.Sources: MDN Web Docs, "pathLength" attribute reference (last modified November 12, 2026), read November 21, 2026. The export behavior described above was read from this site's own export code on November 21, 2026. Download counts: this site's anonymous download log, counted November 21, 2026.