induwara.lk
induwara.lkStatistics · Economics

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.

By Induwara AshinsanaUpdated Jul 17, 2026
Gini coefficient calculator
Two-method verified

One number per entry — commas, spaces, or new lines. All must be zero or positive.

How many people hold each value, aligned one-to-one. Leave blank to weight every value equally.

Try
Gini coefficient
0.376
0 = perfect equality · 1 = maximum inequality
Gini index
37.6
Gini coefficient × 100 (World Bank scale)
Interpretation
Moderate inequality
A middling spread — common across many middle-income countries, including much of South and East Asia.
Observations
5
Mean-difference cross-check ✓

Lorenz curve

Cumulative population →Cumulative value →

Inequality ratios

Palma ratio
1.39×

Top 10% share ÷ bottom 40% share

S80 / S20
6.25×

Top 20% share ÷ bottom 20% share

Top 10% holds
25%

of total value

Bottom 40% holds
18%

of total value

Quintile shares

Population bandShare of valueCumulative
Bottom 20%8%8%
2nd 20%10%18%
Middle 20%12%30%
4th 20%20%50%
Top 20%50%100%

Step-by-step working

  1. Sorted values (ascending): 40,000, 50,000, 60,000, 100,000, 250,000
  2. n = 5, Σy = 500,000, mean ȳ = 100,000
  3. Σ(i · yᵢ) with i = rank 1…n = 1,970,000
  4. G = (2 × 1,970,000) / (5 × 500,000) − (5+1)/5 = 0.376

How it compares (World Bank Gini index)

CountryGini indexSurvey year
Slovakia24.12021
Sweden29.82021
Germany31.72020
United Kingdom32.62021
India32.82021
Japan32.92013
Your distributionModerate inequality37.6
Sri Lanka37.72019
United States41.32022
Brazil522022
South Africa632014

Reference figures are the latest available World Bank estimate per country at 2026-07-17 and may lag several years behind the current date.

Formulas from Gini (1912) and Sen's On Economic Inequality; interpretation bands and the country snapshot from the World Bank and OECD. Snapshot last verified 2026-07-17.

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

Example 1 — five salaries, verified two ways

Raw values (LKR): 40,000 · 50,000 · 60,000 · 100,000 · 250,000

  1. Sort ascending; n = 5, Σy = 500,000, mean ȳ = 100,000.
  2. Sorted-rank: Σ(i·yᵢ) = 1·40k + 2·50k + 3·60k + 4·100k + 5·250k = 1,970,000.
  3. G = (2 × 1,970,000) / (5 × 500,000) − 6/5 = 1.576 − 1.2 = 0.376.
  4. Mean-difference check: sum of all pairwise |differences| = 1,880,000.
  5. G = 1,880,000 / (2 × 5² × 100,000) = 0.376 ✓ — both methods agree.
  6. Gini index = 37.6 → 'moderate' inequality band.

Example 2 — grouped decile shares

Income share % by poorest→richest decile: 3, 4, 5, 6, 7.5, 9, 11, 13.5, 17, 24

  1. Cumulative value share Yₖ: 0.03, 0.07, 0.12, 0.18, 0.255, 0.345, 0.455, 0.59, 0.76, 1.00.
  2. Equal deciles, so each Xₖ − Xₖ₋₁ = 0.1.
  3. Σ (Yₖ + Yₖ₋₁) = 6.61.
  4. G = 1 − 0.1 × 6.61 = 1 − 0.661 = 0.339 (Gini index 33.9).
  5. Lower than the true microdata Gini because the trapezoid smooths within-decile spread.

Example 3 — the two extremes (edge cases)

Perfect equality vs one person takes all

  1. Equal incomes [100, 100, 100, 100, 100]: every pairwise difference is 0.
  2. G = 0 / anything = 0.000 → perfect equality, the Lorenz curve sits on the 45° line.
  3. One takes all [0, 0, 0, 0, 100]: n = 5, Σy = 100, mean = 20.
  4. G = 0.800 for this sample; with the n/(n−1) correction it approaches 1.0.
  5. As n grows with one person holding everything, G → 1 (maximum inequality).

Frequently asked questions

Sources & references

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

Rate this tool
Be the first to rate

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.