Gini Coefficient & Lorenz Curve Calculator
Measure income or wealth inequality from a raw list of numbers or grouped decile/quintile shares. Get the Gini coefficient (0–1) and Gini index, the Lorenz curve, the Palma and quintile ratios, and every step of the working — free, in your browser, sources cited.
How it works
The Gini coefficient summarises how evenly a quantity — income, wealth, salaries, sales — is spread across a population in a single number from 0 (everyone has the same) to 1 (one person has everything). It is the most widely cited inequality measure, published for every country by the World Bank as the Gini index (the coefficient multiplied by 100).
This calculator offers two mathematically grounded routes, chosen by your input mode. Both are documented so a student can reproduce the answer by hand.
1. Raw values (the exact method)
With individual numbers, the tool sorts them ascending (y₁ ≤ y₂ ≤ … ≤ yₙ) and applies the sorted-rank form, where i is each value's rank:
G = ( 2 · Σ i·yᵢ ) / ( n · Σ yᵢ ) − (n + 1) / n
This is algebraically identical to the original relative-mean-absolute-difference definition of Gini (1912) and Sen's On Economic Inequality: the average of every pairwise difference, divided by twice the mean, G = Σᵢ Σⱼ |yᵢ − yⱼ| / (2 · n² · ȳ). The calculator computes the efficient sorted-rank form and then independently re-derives the answer with the pairwise mean-difference formula, so you can see the two methods agree. Frequencies expand each value by its weight before sorting.
2. Grouped shares (deciles / quintiles)
When you only have the percentage of income held by each group, the tool converts them to cumulative population shares Xₖ and cumulative value shares Yₖ (with X₀ = Y₀ = 0) and takes one minus the trapezoidal area under the Lorenz curve:
G = 1 − Σ ( Xₖ − Xₖ₋₁ ) · ( Yₖ + Yₖ₋₁ )
Because the trapezoid interpolates linearly within each group, grouped Gini slightly under-estimates the true microdata value — the calculator notes this and shows the cumulative shares it used. An optional small-sample correction (× n/(n−1), after Deaton) is available for raw data when you are inferring from a sample rather than a full population; it is off by default to match the World Bank and census-published convention.
Worked examples
Frequently asked questions
Sources & references
- World Bank — Gini index (SI.POV.GINI), definition and Sri Lanka series
- OECD — Income inequality indicator (methodology and interpretation bands)
- Department of Census and Statistics, Sri Lanka — Household Income and Expenditure Survey (HIES)
- Deaton, A. — The Analysis of Household Surveys (small-sample correction)
The interpretation bands and the country-comparison snapshot were last cross-checked against the World Bank and OECD sources on 2026-07-17. Published national Gini figures can lag the current year by several survey cycles — always confirm the latest value at the source.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] — most fixes ship within 24 hours.