How to use the pie chart maker
- Enter your data in the text area, one slice per line, using the format
Label, Value. - Optionally provide a comma-separated list of hex colours to style each slice.
- Check Donut chart if you want a ring instead of a filled circle.
- Click Generate to render the SVG pie chart with a percentage legend.
- Copy the SVG code or use it directly in your project; the file is ready to download.
How the angles are calculated
A full circle contains exactly 360 degrees. To find the angle for each slice, divide its value by the total of all values and multiply by 360. For example, if three categories hold 40, 30 and 30 units, the total is 100. The first slice spans 40 / 100 * 360 = 144 degrees, while the other two each span 108 degrees.
The same ratio gives the percentage shown in the legend: value / total * 100. Percentages are rounded to one decimal place for display, but the underlying geometry uses the exact fraction so the slices always close the circle perfectly without gaps or overlaps.
Drawing arcs in SVG
The pie chart maker renders each slice as an SVG <path> using the arc command (A). The path starts at the centre of the circle, draws a line to the outer edge, sweeps an arc along the circumference, and closes back to the centre. The large-arc-flag is set to 1 when a slice exceeds 180 degrees so the renderer knows which way to curve.
For a donut chart, an SVG mask cuts a circular hole out of the pie, so the centre is truly empty even with a transparent background. The inner radius is typically 60 percent of the outer radius, leaving enough room for the coloured ring while keeping the chart readable.
Common reference values
When planning a chart it helps to know how common fractions map to degrees and percentages.
| Fraction | Degrees | Percentage |
|---|---|---|
| 1/2 | 180° | 50% |
| 1/3 | 120° | 33.33% |
| 1/4 | 90° | 25% |
| 1/5 | 72° | 20% |
| 1/6 | 60° | 16.67% |
| 1/8 | 45° | 12.5% |
| 1/10 | 36° | 10% |
| 1/12 | 30° | 8.33% |
Practical uses for pie and donut charts
Pie charts work best when you need to show how a whole divides into a small number of parts. Budget breakdowns, survey responses, market share distributions and time allocation are typical examples. Keep the number of slices under seven; beyond that the segments become too narrow to compare visually.
Donut charts serve the same purpose but free up the centre area. Designers often place the total value or a short heading inside the hole. Donuts are a matter of taste; for precise comparison between categories a bar chart is usually easier to read than any pie.
If you need to size graphics for specific layouts, check our tools for poster size or instagram post size to ensure your exported SVG fits the target dimensions.
Mistakes to avoid
The most frequent error is including negative values. A pie chart represents parts of a positive whole, so every value must be zero or greater. If your dataset contains negatives, transform them or choose a bar chart instead.
Another pitfall is providing too many categories. When a chart has fifteen tiny slivers, readers cannot distinguish them even with distinct colours. Group minor categories into an "Other" slice to keep the visual clear.
Finally, verify that your colours have enough contrast against each other and against the background. Adjacent slices with similar hues blend together, defeating the purpose of the chart. Use a palette with varied lightness and saturation for best results.
Worked examples
| Example | Input | Result |
|---|---|---|
| Market share | Data (one per line: label, value): Company A, 45 / Company B, 30 / Company C, 15 / Others, 10; Colours (comma-separated hex codes or names): #4e79a7, #f28e2b, #e15759, #76b7b2; Donut chart: no; Background: white | Company A: 45%; Company B: 30%; Company C: 15%; Others: 10% |
| Budget donut | Data (one per line: label, value): Housing, 1200 / Food, 600 / Transport, 300 / Savings, 400; Colours (comma-separated hex codes or names): #59a14f, #edc948, #b07aa1, #ff9da7; Donut chart: yes; Background: transparent | Housing: 48%; Food: 24%; Transport: 12%; Savings: 16% |
| Survey results | Data (one per line: label, value): Yes, 62 / No, 28 / Unsure, 10; Colours (comma-separated hex codes or names): #4e79a7, #e15759, #bab0ac; Donut chart: no; Background: white | Yes: 62%; No: 28%; Unsure: 10% |
FAQ
Do the slices always add up to 360 degrees?
Yes. Each slice angle is computed as (value / total) * 360 from the exact fraction, so the slices close the circle. The displayed degrees and percentages are rounded to one decimal place and may not add up to exactly 360 or 100.
Can I make a donut chart instead of a filled pie?
Check the Donut chart option before generating. The tool masks out a circle in the centre to create the ring shape while keeping the same proportional slices, and the hole stays transparent if you choose a transparent background.
What happens if I enter fewer colours than slices?
The pie chart maker cycles through the provided colour list. If you supply three colours for five slices, the fourth slice reuses the first colour and the fifth reuses the second.
Is my data sent to a server?
No. Everything runs locally in your browser. Your labels, values and generated SVG never leave your device.
How do I download the chart?
After generation, copy the SVG markup from the output area and save it as a .svg file. You can open it in any browser or import it into design software like Figma or Illustrator.
Why does a single slice not draw correctly?
An SVG arc from a point back to itself produces no visible path. The tool handles this edge case by drawing a full circle instead of an arc when only one category has a value above zero.
Can I use decimals in the values?
Yes. Values like 12.5 or 0.003 are accepted. The tool sums them normally and computes proportions from the exact total.