Gini Coefficient Calculator
Paste a list of incomes, or the share of income that each group such as a quintile receives, and the calculator returns the Gini coefficient with the formula worked out, a small-sample variant, and a Lorenz curve with the gap that the coefficient measures shaded in. It runs in your browser and nothing is uploaded.
Use semicolons if your numbers have decimal commas. Incomes must be 0 or more.
Results
0.4498
Gini coefficient
0.4998
Small-sample Gini, G × n ÷ (n − 1)
0.9
Highest possible for this many people
69.7
Mean income
10
People counted
Working
- Sorted incomes: 12, 18, 25, 32, 40, 55, 70, 95, 130, 220
- Σ i × income₍ᵢ₎ = 5,401, with the incomes sorted from smallest to largest
- G = 2 × 5,401 ÷ (10 × 697) − (10 + 1) ÷ 10 = 0.4498
- Small-sample version: 0.4498 × 10 ÷ (10 − 1) = 0.4998
This equals the average gap between every pair of incomes divided by twice the mean. The small-sample version rescales the maximum to 1, for data that are a sample of a larger population.
Show the graph data as a table
| Cumulative share of people (%) | Cumulative share of income (%) |
|---|---|
| 0 | 0 |
| 10 | 1.72 |
| 20 | 4.3 |
| 30 | 7.89 |
| 40 | 12.48 |
| 50 | 18.22 |
| 60 | 26.11 |
| 70 | 36.15 |
| 80 | 49.78 |
| 90 | 68.44 |
| 100 | 100 |
How to Use the Gini Coefficient Calculator
- 1. Choose the kind of data. Individual incomes, one per person or household, give the most exact answer. Grouped shares suit published tables, such as the share of income held by each fifth of the population.
- 2. Enter the numbers. For incomes, separate them with commas, spaces or new lines. For groups, put one group per line: the population share and the income share, or just the income share when the groups are equal in size.
- 3. Read the coefficient. The Gini coefficient runs from 0, where everyone has the same, towards 1, where one person has everything. The working shows the formula with your numbers in it.
- 4. Look at the Lorenz curve. The further the curve bows below the dashed line of equality, the larger the shaded gap and the higher the coefficient.
How the Gini Coefficient Is Calculated
The Gini coefficient is the average gap between every pair of incomes, expressed as a fraction of twice the mean income. With incomes sorted from smallest to largest, there is a quicker form with the same result:
Definition
G = Σᵢ Σⱼ |xᵢ − xⱼ| ÷ (2 n² μ)
Sorted form
G = 2 Σ i × x₍ᵢ₎ ÷ (n Σ x) − (n + 1) ÷ n
Small-sample variant
G′ = G × n ÷ (n − 1)
For incomes of 1, 2, 3 and 4 the absolute differences over all ordered pairs add up to 20, and twice n² times the mean is 2 × 16 × 2.5 = 80, so G = 20 ÷ 80 = 0.25. With n people, the largest value the coefficient can take is (n − 1) ÷ n, when one person has everything; the small-sample variant rescales that maximum to exactly 1. It is the version to use if your data are a sample drawn from a larger population, and the two converge as n grows.
The Lorenz Curve
To draw the Lorenz curve, sort the people from poorest to richest and plot the cumulative share of the population along the horizontal axis against the cumulative share of income they hold on the vertical axis. Perfect equality is the diagonal. The Gini coefficient is the area between the diagonal and the curve (area A) divided by the whole area under the diagonal (A + B), which equals 2A. In the default example of ten incomes, the poorest half of people hold 18.22% of the income, and the richest person alone holds 31.56%; the coefficient is 0.4498, and 0.4998 with the small-sample correction.
Grouped Data
With income shares of 5%, 10%, 15%, 25% and 45% for five equal groups, the Lorenz curve passes through cumulative shares of 5, 15, 30, 55 and 100 at population shares of 20, 40, 60, 80 and 100. Joining those points with straight lines and taking the area under them gives 0.31, so G = 1 − 2 × 0.31 = 0.38. Because the straight lines ignore inequality inside each group, the grouped Gini is a lower bound on the true value, and it rises when you have more groups.
Reading the Result and Its Limits
Treat the coefficient as a summary, not a diagnosis. It is unchanged if every income is multiplied by the same amount, and unchanged if the whole population is duplicated, so it measures relative inequality, not how rich anyone is. It also reacts most to changes around the middle of the distribution and least to changes at the very top or bottom, and it says nothing about who is in which position or whether people move between positions over time. Check what the numbers measure before comparing two coefficients: household or individual, before or after tax, income or consumption, and the year.
Frequently Asked Questions
- What is a good Gini coefficient?
- Lower means more equal, but there is no ideal value. Most countries' income Gini coefficients fall roughly between 0.25 and 0.65, and the figure depends on whether it measures income before or after taxes and transfers, or consumption or wealth. Compare only figures built the same way.
- How do you calculate the Gini coefficient by hand?
- Sort the incomes from smallest to largest and number them 1 to n. Add up each income multiplied by its rank, then use G = 2 × that sum ÷ (n × total income) − (n + 1) ÷ n. The working in the calculator shows each of these numbers for your data.
- What is the difference between the Gini coefficient and the Gini index?
- They are the same measure on different scales. The coefficient runs from 0 to 1 and the index multiplies it by 100, so a coefficient of 0.45 is an index of 45. The World Bank and many news reports use the index.
- Why is there a small-sample Gini?
- With only n people the coefficient cannot reach 1, since its highest possible value is (n − 1) ÷ n. Multiplying by n ÷ (n − 1) fixes the maximum at 1, which matters for small samples. For large populations the correction is negligible.
- Can the Gini coefficient be greater than 1?
- It can if some people have negative incomes or net worth, because the Lorenz curve then dips below zero. This calculator accepts only incomes of 0 or more, so its result stays between 0 and 1.
- What does the Lorenz curve show that the Gini coefficient does not?
- Where the inequality lies. Two different Lorenz curves can enclose the same area and give the same coefficient, one with a very rich top and the other with a very poor bottom. The curve lets you see which, which is why it is plotted beside the number.