What the Gini Coefficient Measures
The Gini coefficient is a single number between 0 and 1 that tells you how unequally income or wealth is distributed across a population. A Gini of 0 means perfect equality—everyone has the same income. A Gini of 1 means perfect inequality—one person has everything. Most real countries fall between 0.25 and 0.65.
You calculate it by comparing what people actually earn against a theoretical world where everyone earns the same amount. The larger the gap between those two scenarios, the higher the inequality, and the higher your Gini coefficient.
Economists and policy researchers use the Gini to compare inequality across countries, track how it changes over time, or measure the effect of taxes and welfare programs. If you are working with income data and need a single measure of how spread out that income is, the Gini is the standard tool.
Key Takeaways
- The Gini coefficient ranges from 0 (perfect equality) to 1 (perfect inequality) and is calculated by comparing actual income distribution to a perfectly equal distribution.
- The formula requires you to sort incomes from lowest to highest, assign each person a rank, and sum the differences between actual and theoretical cumulative income shares.
- A spreadsheet with the Lorenz curve formula is faster and less error-prone than hand calculation for datasets larger than 10 or 15 people.
- The Gini coefficient alone does not tell you whether inequality is good or bad—it is only a measurement tool that lets you compare distributions.
The Formula and What Each Part Means
The most common formula for the Gini coefficient is:
G = (2 × Σ(i × y_i)) / (n × Σy_i) − (n + 1) / n
Breaking this down: i is the rank of each person (1st, 2nd, 3rd, and so on), y_i is that person's income, n is the total number of people, and Σ means "add them all up." The numerator captures how much income is concentrated at the top; the denominator normalizes that to a 0–1 scale.
A simpler way to think about it: you are measuring the area between the line of perfect equality and the actual income distribution curve (called the Lorenz curve). The bigger that gap, the higher the Gini.
Step-by-Step Calculation by Hand
Start with a small dataset so you can see how the calculation works. Suppose you have five people earning $20,000, $30,000, $40,000, $50,000, and $60,000.
Step 1: Sort the incomes from lowest to highest. They already are: $20k, $30k, $40k, $50k, $60k.
Step 2: Assign each person a rank. Person 1 earns $20k, person 2 earns $30k, and so on.
Step 3: Multiply each rank by that person's income. This gives you: (1 × 20,000) + (2 × 30,000) + (3 × 40,000) + (4 × 50,000) + (5 × 60,000) = 20,000 + 60,000 + 120,000 + 200,000 + 300,000 = 700,000.
Step 4: Add up all the incomes. $20,000 + $30,000 + $40,000 + $50,000 + $60,000 = $200,000.
Step 5: Plug into the formula. G = (2 × 700,000) / (5 × 200,000) − (5 + 1) / 5 = 1,400,000 / 1,000,000 − 1.2 = 1.4 − 1.2 = 0.2. Your Gini coefficient is 0.2, indicating relatively low inequality in this small group.
Using a Spreadsheet for Larger Datasets
For more than 15 or 20 people, hand calculation becomes tedious and error-prone. A spreadsheet is much faster and lets you change the data without recalculating everything by hand.
Set up your spreadsheet with three columns: Column A holds the income values (unsorted), Column B sorts them from lowest to highest using the SORT function, and Column C calculates the rank (1, 2, 3, and so on). In Column D, multiply the rank by the income. In Column E, calculate the cumulative share of income at each rank.
Once you have those columns, the Gini formula becomes a single cell that references the sums. In Excel or Google Sheets, write: =2*SUM(C2:C[last row])/(COUNT(C2:C[last row])*SUM(B2:B[last row]))−(COUNT(C2:C[last row])+1)/COUNT(C2:C[last row]). Replace [last row] with the actual row number of your last data point.
Google Sheets and Excel both have built-in functions for some inequality measures, but the Gini usually requires you to build it yourself using the formula above. This takes about five minutes once you have the data entered.
Common Mistakes When Computing the Gini
The most frequent error is forgetting to sort the incomes from lowest to highest before assigning ranks. The formula depends on rank order; if your data is scrambled, your Gini will be wrong. Always sort first.
A second mistake is using the wrong denominator. Some formulas use (n − 1) instead of n, which gives a slightly different result. Check which version your textbook or assignment specifies, because the difference matters if you are comparing your answer to a published figure.
A third error is including zero or negative incomes without thinking about what they mean. A person with zero income should be included (they have no share of the total), but negative income (debt) can distort the calculation. If your dataset includes negative values, note that in your write-up and consider whether the Gini is the right tool for that data.
Finally, do not assume a higher Gini is always bad or a lower one always good. The Gini is a measurement, not a judgment. A Gini of 0.3 in one country might reflect high social mobility, while the same Gini in another might reflect low average income. Always pair the Gini with other context.
Interpreting Your Result
Once you have your Gini coefficient, you need to know what it means in context. A Gini below 0.3 generally indicates relatively equal income distribution—common in Nordic countries. A Gini between 0.3 and 0.4 is moderate inequality, typical of many developed nations. A Gini above 0.5 indicates high inequality, common in developing countries and some wealthy nations with large wealth gaps.
The Gini is most useful when you compare it to another Gini from the same country in a different year, or to the Gini of a peer country. A single Gini number floating alone does not tell you much. But a Gini that rises from 0.35 to 0.42 over a decade tells you inequality is growing in that place.
Remember that the Gini measures income or wealth distribution, not poverty. A country could have a low Gini (equal distribution) but still have widespread poverty if everyone is equally poor. Conversely, a high Gini does not automatically mean most people are poor—it only means income is concentrated.
When to Use the Gini and When to Use Alternatives
The Gini is the most widely reported inequality measure, which makes it useful for comparison and communication. If you are writing a report that will be read by policymakers or the public, the Gini is a safe choice because people recognize it.
However, the Gini has limits. It does not tell you where the inequality is concentrated—whether the top 1 percent is pulling away or the bottom 50 percent is falling behind. For that, you might use the Palma ratio (income of the top 10 percent divided by the bottom 40 percent) or a percentile share analysis.
The Gini also treats all income differences the same way. A $10,000 gap between a person earning $20,000 and one earning $30,000 counts the same as a $10,000 gap between someone earning $990,000 and $1,000,000. If you care more about poverty than extreme wealth, other measures might be more appropriate.
Frequently Asked Questions
Can I calculate the Gini coefficient with grouped data instead of individual incomes?
Yes, but it requires a different formula. If you have data in income brackets (for example, "10 percent of people earn $0–$20,000"), you use the midpoint of each bracket and weight it by the share of the population in that bracket. The calculation is more complex, but the principle is the same: you are comparing actual distribution to perfect equality.
What if some people in my dataset have the same income?
That is fine. Assign them consecutive ranks anyway (1, 2, 3, 4, and so on), even if two people have identical incomes. The formula handles ties without any special adjustment. Your Gini will be slightly lower than if those people had different incomes, which correctly reflects that there is less inequality.
Does the Gini coefficient change if I measure income in a different currency?
No. The Gini is a ratio, so it is unit-free. Whether you measure income in dollars, euros, or thousands of dollars, the Gini stays the same. This is one reason it is useful for international comparison.
How do I know if my Gini calculation is correct?
Test it on a dataset where you know the answer. If everyone has the same income, the Gini should be exactly 0. If one person has all the income and everyone else has zero, the Gini should be very close to 1. If your formula does not produce those results, check your spreadsheet formula or your hand calculation for errors.
Should I use the Gini or the Lorenz curve?
They measure the same thing in different ways. The Lorenz curve is a graph that shows cumulative income share on the y-axis and cumulative population share on the x-axis. The Gini is the area between that curve and the line of perfect equality, expressed as a single number. Use the Lorenz curve if you want to visualize inequality; use the Gini if you want to compare it numerically.