Gini Coefficient Calculator: Incomes, Quintiles, Lorenz Curve
By FindMySum · Last reviewed
The Gini coefficient is the most widely used single measure of inequality. It condenses a whole distribution of incomes, or of wealth, into one number between 0 and 1. At 0 everyone has the same income; at 1 one person has it all. This calculator works it out either from a list of individual incomes or from the income shares of equal-sized groups such as quintiles or deciles, the form in which statistical agencies publish distributions. It draws the Lorenz curve and gives the shares held by the bottom 40% and the top 10%, the Palma ratio and the S80/S20 ratio.
The Lorenz curve
Line everyone up from the lowest income to the highest. The Lorenz curve plots, for each share of people counted from the bottom, the share of total income they receive. If incomes were equal, the poorest 40% would have 40% of income and the curve would be the diagonal line of equality. In practice it sags below the diagonal: the bottom 40% have less than 40%, and the top 10% more than 10%.
The Gini coefficient is the area between the line of equality and the Lorenz curve, divided by the whole area under the diagonal. Since that triangle has an area of one half, the Gini is twice the area between the two lines.
Gini from a list of incomes
For individual values the calculator uses the mean absolute difference: take the absolute difference between every pair of incomes, average it, and divide by twice the mean.
G = Σᵢ Σⱼ |xᵢ − xⱼ| ÷ (2 n² μ)
For the incomes 1, 2, 3, 4 and 5, the differences between all 25 ordered pairs add up to 40, and the mean is 3, so G = 40 ÷ (2 × 25 × 3) = 0.267. With this formula even total inequality only reaches (n − 1) ÷ n, 0.75 for four people, so analysts working with small samples multiply by n ÷ (n − 1). That correction is in the advanced options; it makes the five-income example 0.333.
Gini from quintile or decile shares
Agencies rarely release individual data. Instead they publish the share of income going to each fifth (quintile) or tenth (decile) of the population. Those shares give points on the Lorenz curve, and the calculator joins them with straight lines and measures the area with the trapezoid rule:
G = 1 − Σ (Xⱼ − Xⱼ₋₁)(Yⱼ + Yⱼ₋₁)
where X is the cumulative share of people and Y the cumulative share of income. Because it treats everyone inside a group as equal, a Gini from grouped data is a little lower than one from the underlying records. With more groups, the difference shrinks.
Worked example: Canada's after-tax income, 2024
The calculator opens on Statistics Canada's decile shares of adjusted after-tax income for 2024, from the poorest tenth to the richest: 2.7, 4.8, 6.1, 7.2, 8.3, 9.5, 10.8, 12.4, 14.8 and 23.3%. The published shares add up to 99.9% because of rounding, so the calculator rescales them to 100%.
- Bottom 40%: 2.7 + 4.8 + 6.1 + 7.2 = 20.8%, or 20.82% after rescaling.
- Top 10%: 23.3%, or 23.32% after rescaling.
- Palma ratio: 23.32 ÷ 20.82 = 1.12. The richest tenth receive slightly more income than the poorest four tenths combined.
- S80/S20: the top fifth's 38.1% divided by the bottom fifth's 7.5% gives 5.08.
- Gini from the ten deciles: 0.299. Statistics Canada's official after-tax Gini for 2024, computed from the survey records, is 0.305.
Before taxes and government transfers, the market-income Gini is 0.436. The tax and transfer system narrows it to 0.305, one of the clearest measures of what redistribution does.
Choosing a measure
The Gini coefficient is most sensitive to changes in the middle of the distribution. The Palma ratio was proposed because the middle half of the population tends to receive about half of income in most countries, so differences in inequality come mainly from the top 10% and the bottom 40%. The OECD publishes the Gini, S80/S20 and Palma ratios side by side. When comparing figures, check that they use the same income concept (market, total or after-tax income), the same unit (persons, families or households) and the same adjustment for household size, because each choice changes the result.
More questions
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; the index is the coefficient times 100, so a Gini coefficient of 0.30 is a Gini index of 30. The World Bank publishes the index; Statistics Canada and the OECD publish the coefficient.
Is a lower Gini coefficient always better?
It depends on what you value. A low Gini means income is shared evenly, but it says nothing about how high incomes are: two countries can have the same Gini at very different living standards. Most economists read it alongside median income and poverty rates.
Why do Gini coefficients for Canada differ between sources?
They use different income concepts (market, total or after-tax), units (individuals, families or households), equivalence scales and surveys. Statistics Canada's official series adjusts household income for household size and counts every person. The OECD's figure for Canada uses a similar method, but other sources can give values a few hundredths apart.
Can two different distributions have the same Gini coefficient?
Yes. Lorenz curves that cross can enclose the same area: one society may have a poorer bottom and a less dominant top than another, yet both score the same. That is why the calculator also shows the shares of the bottom 40% and top 10%, and the Palma ratio.
How do I calculate a Gini coefficient in Excel?
Sort the incomes from smallest to largest in A1:A(n), put 1 to n in B1:B(n), and use = 2 * SUMPRODUCT(A1:An, B1:Bn) / (n * SUM(A1:An)) - (n + 1) / n, with n replaced by the number of incomes. That is the sorted form of the mean absolute difference formula and gives the same result as this calculator in list mode without the correction.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.