Understanding the Gini coefficient calculator — concept and principle
This calculator measures income inequality in a list of incomes with the Gini coefficient, using the Lorenz curve. It also gives the Gini index (× 100), the number of incomes, the mean and median, and the income shares of the top and bottom 20%. Use it for economics and statistics courses, analysing pay distributions or understanding inequality statistics.
How it is calculated
- Sort incomes from lowest to highest.
- Lorenz curve: cumulative share of people (k ÷ n) against cumulative share of income L_k.
- Gini = A ÷ (A + B), the area between the equality line and the curve divided by the whole triangle.
- With straight segments: G = 1 − Σ (1 ÷ n)(L_k + L_(k−1)).
- Equivalent: mean absolute difference between all pairs ÷ (2 × mean).
Top and bottom 20% shares are read from the same curve.
The principle
If everyone had the same income, the bottom 20% of people would have 20% of income, and the Lorenz curve would be the straight diagonal. Inequality bends the curve below the diagonal: the poorer half has less than half the income. The Gini coefficient measures how far the curve sags, from 0 (perfect equality) to 1 (one person has everything). It summarises the whole distribution in one number, so different shapes can share the same Gini.
Worked example
Default incomes: 18,000; 24,000; 29,000; 33,000; 38,000; 44,000; 52,000; 63,000; 80,000; 140,000.
- Total = 521,000; mean = 52,100; median = (38,000 + 44,000) ÷ 2 = 41,000.
- Bottom 20% (two lowest) = 42,000 ÷ 521,000 ≈ 8.1%.
- Top 20% (two highest) = 220,000 ÷ 521,000 ≈ 42.2%.
- Summing the Lorenz trapezoids gives G ≈ 0.331; Gini index 33.1.
How to read the result
Values around 0.25 to 0.35 for disposable household income are common in many developed countries; higher values indicate more inequality. Compare only Gini values computed the same way: before or after taxes and transfers, per person or per household, and from the same type of data. Small samples, like ten incomes, give rough estimates.
Common mistakes
- Comparing Gini values based on different income definitions.
- Forgetting to sort incomes before building the Lorenz curve.
- Treating the Gini as a measure of poverty; it measures spread, not living standards.
- Including negative incomes without care, which can push the Gini above 1.
Frequently asked questions
What does a Gini coefficient of 0 mean?
Everyone has exactly the same income.
What is the difference between the Gini coefficient and the Gini index?
The index is the coefficient multiplied by 100.
Can two very different distributions have the same Gini?
Yes. The Gini summarises the whole curve in one number, so different shapes can match.
Sources: Singapore Department of Statistics, "Understanding the Gini Coefficient" · UN SIAP, "Gini Coefficient Supplemental Handout"