Gini Coefficient Calculator
Measure how unevenly a set of values is spread, from one figure for perfect equality up to one for total inequality.
What it does
Two groups can have the same average and still be worlds apart. A Gini coefficient puts a single number on that difference. It runs from zero, where every value is identical, to one, where one holder has everything and the rest have nothing.
The World Bank, which publishes the Gini index for countries, describes it as the area between the Lorenz curve and a hypothetical line of absolute equality, expressed as a share of the maximum area under that line. The Lorenz curve plots the cumulative share of the total against the cumulative share of the people, starting with the poorest. A Gini index of 0 means perfect equality and an index of 100 means perfect inequality.
The same World Bank note explains what the number means in plain language: it is the average share of mean income that has to be moved between two randomly picked people to make them equal. A lower number means the distribution is tighter, a higher number means the gap between rich and poor is wider. The bank also notes that a Gini index above 0.4 counts as high inequality for a country.
This page works from a plain list of values, such as household incomes, wages or holdings. It sorts them, builds the Lorenz curve behind the scenes and reports the Gini coefficient on both the 0 to 1 scale and the 0 to 100 index scale, alongside the mean, the median and the shares that go to the top and the bottom of the list.
The limits are worth stating. The Gini coefficient is not additive across groups, so country figures cannot be added up to make a regional figure. Two different distributions can share the same Gini value. And the World Bank warns that it measures relative, not absolute, wealth, so a country can become more unequal by the index while the number of people in absolute poverty falls.
How to use
- Enter the values to compare, separated by commas. Use one row per person, or one number per unit you want to compare.
- Enter at least 3 values. A list of 10 to 50 gives a picture that is worth reading.
- Read the Gini coefficient, which runs from 0 to 1, and the index value right below it, which runs from 0 to 100 the way the World Bank reports it.
- Compare the mean with the median. A mean well above the median means a few large values are pulling the average up.
- Read the share held by the top fifth and by the bottom fifth, which is often easier to quote than the index.
- Try removing the largest value and running the numbers again. A big drop means that single value is doing a lot of work.
Formula
- G
- Gini coefficient between 0 and 1. Multiply by 100 for the index scale.
- n
- Number of values in the list.
- rank
- Position of each value once the list is sorted from smallest to largest, starting at 1.
- x
- Each value in the list, such as an income.
This is the rank based form of the coefficient, which is the one used for small lists and for grouped data. For a population split into equal groups the same number comes from the area under the Lorenz curve. The index scale the World Bank uses is simply the coefficient multiplied by 100, so a coefficient of 0.4023 reads as 40.2 on the index.
Worked example
Example: five incomes from 12000 to 95000
Defaults: a list of five values, 12000, 18000, 22000, 30000 and 95000.
- Sort the values, which are already in order: 12000, 18000, 22000, 30000, 95000.
- The total is 177000, so the mean is 177000 / 5 = 35400.
- Multiply each value by its rank: 1 x 12000 + 2 x 18000 + 3 x 22000 + 4 x 30000 + 5 x 95000 = 709000.
- The coefficient is 2 x 709000 / (5 x 177000) - 6 / 5 = 1.602259 - 1.2 = 0.4023.
- On the index scale that is 40.2, which is above the 0.4 line the World Bank calls high inequality.
- The median is the third value, 22000, and the mean of 35400 sits well above it because of the 95000.
- The top fifth is the single value of 95000, which is 53.7 % of the total, and the bottom fifth is 12000, which is 6.8 %.
Reference table
| Distribution | Gini coefficient | Index value | Top fifth share |
|---|---|---|---|
| Ten identical values of 10000 | 0.0000 | 0.0 % | 20.0 % |
| 20000, 21000, 19000, 22000, 18000, 20000 | 0.0361 | 3.6 % | 18.3 % |
| 12000, 18000, 22000, 30000, 95000 | 0.4023 | 40.2 % | 53.7 % |
| 5000, 6000, 7000, 8000, 9000, 100000 | 0.5988 | 59.9 % | 74.1 % |
Limits
- The Gini coefficient is not additive across groups, so the Gini of a region cannot be found by adding the Gini of its parts.
- Two different distributions can give the same coefficient, so the number alone never describes a distribution in full.
- It measures relative rather than absolute differences, so it can rise while the poorest are still better off than before.
- The value depends on the list you feed in, so a household Gini and a national Gini are not comparable numbers.
Common mistakes
- Reading 0.4023 as 40.23 percent of income. The index scale multiplies the coefficient by 100, so it is 40.2 on the index.
- Forgetting that the list has to be sorted before the ranks are used. The rank of a value is its position from the smallest.
- Comparing a Gini from a small list of households with a national Gini from the World Bank. They are built on different populations.
- Assuming a higher Gini always means a worse life for everyone. The number only describes the spread, not the level.
- Leaving out the zeros. A list of 1000 values where 900 are zero and 100 are equal has a Gini of 0.9, and dropping the zeros would give 0.
Try it yourself
Quick checks. Answers sit tucked under each question.
What happens to the Gini coefficient when everyone earns the same?
It is exactly 0.0000, which reads 0.0 on the index scale, because every value has the same rank share and the Lorenz curve sits on the line of equality. A list of ten values of 10000 gives 0.0000 with a mean and a median of 10000.
Six values between 18000 and 22000 give what result?
A Gini coefficient of 0.0361, which reads 3.6 on the index. The spread is small, the top fifth of the list holds 18.3 % of the total and the bottom fifth holds 15.0 %, so the two ends look almost the same.
How does adding one very large value change the picture?
A lot. The list 5000, 6000, 7000, 8000, 9000 and 100000 gives a Gini coefficient of 0.5988, which reads 59.9 on the index. The top fifth of the list holds 74.1 % of the total, and the mean of 22500 sits three times above the median of 7500.
Questions
What does a Gini coefficient of 0.4 mean?
It reads 40 on the index scale. The World Bank treats a value above 0.4 as high inequality for a country, which is a policy yardstick rather than a hard line.
What is a Lorenz curve?
A plot of the cumulative share of the total against the cumulative share of the people, ordered from poorest to richest. The Gini coefficient is the area between that curve and the straight line of perfect equality.
Why can the Gini index be misleading?
The World Bank points out that it measures relative rather than absolute wealth, so it can rise while the number of people living in absolute poverty falls. It is also not additive across groups, so country figures cannot simply be added up.
How many values do I need?
At least 3 for the calculation to mean anything. The more values you add, the closer the result sits to the population you are trying to describe.
Can I use it for something other than income?
Yes. The coefficient is about any set of amounts, so it works for wages, wealth, company sizes, household income or even a list of values you want to compare for spread.
What is the rank biserial style alternative?
For a comparison of two groups rather than one distribution, the rank biserial correlation built on the Mann Whitney statistic measures the size of the shift between them on a scale from minus one to plus one.
Sources
- World Bank, World Development Indicators glossary: the Gini index definition and limits
- World Bank poverty and inequality platform methodology: Gini from the Lorenz curve