A Gini coefficient calculator measures how unequally something is shared out among a group, most often income or wealth. Enter one value for each person or household, and the calculator gives the Gini coefficient, from 0 for perfect equality to close to 1 when one person holds almost everything. It also shows the sample version, the highest value possible for a group of that size, the mean and the share held by the top fifth.
The Gini coefficient formula
G = Σᵢ Σⱼ |xᵢ − xⱼ| ÷ (2n² x̄)
For sorted values y₁ ≤ … ≤ yₙ: G = 2 Σ i·yᵢ ÷ (n Σ yᵢ) − (n + 1) ÷ n
Wikipedia's Gini coefficient article defines G as half of the relative mean absolute difference: the average of the absolute differences between every pair of values, divided by twice the mean. It also gives the shortcut for sorted values that the calculator uses, which gives the same answer much faster. For a sample, it gives a version that replaces 1/n with 1/(n − 1), which works out as the population figure multiplied by n ÷ (n − 1). It notes that this sample version is consistent but not in general unbiased.
How to use the Gini coefficient calculator
- Enter one value per person or household. Separate them with spaces, commas or new lines.
- Make sure no value is negative.
- Press Calculate.
Worked example
The article compares two countries of five households, each with a total income of $200,000. In Country A the incomes are $20,000, $30,000, $40,000, $50,000 and $60,000. Sorted, the weighted sum Σ i·yᵢ is 20,000 + 60,000 + 120,000 + 200,000 + 300,000 = 700,000, so G = 2 × 700,000 ÷ (5 × 200,000) − 6 ÷ 5 = 1.4 − 1.2 = 0.2. Country B, with incomes of $9,000, $40,000, $48,000, $48,000 and $55,000, also has a Gini of 0.2, even though its lowest income is far lower. The article uses this pair to show that very different distributions can share the same coefficient.
The range of values
The article explains that the coefficient is 0 when everyone has the same amount and 1 for perfect inequality, but that the maximum for a finite group is 1 − 1/N. With two people, one holding everything and the other nothing, the Gini is 0.5, which is the highest possible for two. That is why the calculator also shows the maximum for the number of values you entered: for small groups the coefficient can never get near 1. The sample correction stretches the result so that the most unequal sample of any size scores 1.
Interpreting the coefficient
The article gives a simple rule of thumb: if the top 20 percent of a population hold 80 percent of the income and everyone within each group is equal, the Gini is 80% − 20% = 60%, or 0.6. In the same way, if the top 1 percent hold 50 percent of the wealth, the wealth Gini is at least 0.49. The calculator shows the share held by the top fifth of your values so you can see how concentrated they are. It also notes that if half of a population has nothing and the other half shares equally, the Gini is 0.5.
Limits of a single number
Because the Gini coefficient compresses a whole distribution into one figure, it can hide important differences, as Countries A and B show. It is also affected by the size of the group, by how households are defined and by whether income is measured before or after taxes and transfers. The article notes that with negative values, such as debts larger than assets, the coefficient can exceed 1, which is why this calculator only accepts values of zero or more. For averages and spread, the average calculator and the standard deviation calculator give a fuller picture.
Uses beyond income
The same formula measures concentration in any set of amounts: sales across customers, traffic across web pages, or market share across firms. A business might find that its sales have a Gini of 0.7, meaning a small number of customers account for most of its revenue, which is a useful thing to know when planning. For market concentration specifically, economists also use the Herfindahl–Hirschman index.
Working through a small example
For three people with incomes of 10, 20 and 30, the values are already sorted. The weighted sum is 1 × 10 + 2 × 20 + 3 × 30 = 140, and the total is 60, so G = 2 × 140 ÷ (3 × 60) − 4 ÷ 3, which is about 0.222. Using the pairwise definition gives the same answer: the absolute differences between every ordered pair add up to 80, and dividing by 2 × 3² × 20 gives 0.222. The calculator does this for any number of values, so you can paste in a whole column from a spreadsheet.
Comparing over time
A single Gini coefficient is most useful when compared with another one measured the same way, such as the same group a few years earlier, or two groups of similar size. If the coefficient rises, the values have become more spread out relative to their average; if it falls, they have become more equal. Keep the definition of income, the unit counted and the group size consistent so that changes in the coefficient reflect real changes in the distribution.
Common mistakes
- Comparing groups of very different sizes. The maximum depends on group size.
- Mixing before-tax and after-tax incomes. Use the same measure throughout.
- Entering negative values. They can push the coefficient above 1.
- Reading too much into one number. Look at the distribution too.
What next
Use this often? Add Gini Coeffic to your Home screen.
Frequently asked questions
How does a Gini coefficient calculator work?
It sorts the values and applies Wikipedia's formula G = 2Σi·yi ÷ (nΣyi) − (n + 1)/n.
What is the Gini of incomes 20,000 to 60,000 in steps of 10,000?
0.2, as in Wikipedia's Country A example.
What does a Gini of 0 mean?
Everyone has the same amount.
Why can't my Gini reach 1?
For n people the maximum is 1 − 1/n, so 0.5 for two people.
What is the sample Gini?
The population figure times n ÷ (n − 1), so the most unequal sample scores 1.
Sources
Was this tool helpful?
What went wrong?
We only receive the reason you pick, never what you typed into the tool.
Thanks for your feedback.