calculating the gini coefficient

Gini Coefficient Calculator

Paste income (or wealth) values below. Use commas, spaces, semicolons, or line breaks as separators.

Use non-negative numbers only. At least 2 values are required.

    What is the Gini coefficient?

    The Gini coefficient is one of the most common ways to measure inequality in a distribution. It is often used for income inequality, but it can also describe inequality in wealth, sales, land ownership, or any other non-negative resource.

    The metric ranges from 0 to 1:

    • 0 means perfect equality (everyone has the same amount).
    • 1 means perfect inequality (one person has everything, everyone else has zero).

    How to calculate the Gini coefficient

    Method 1: From sorted values

    Suppose you have values x₁, x₂, ..., xₙ, sorted from smallest to largest. One efficient formula is:

    G = (2 × Σ(i × xᵢ) / (n × Σxᵢ)) − (n + 1)/n, where i goes from 1 to n.

    This is the formula used in many statistical packages because it is fast and stable for real datasets.

    Method 2: Using the Lorenz curve

    The Lorenz curve plots cumulative population share on the x-axis and cumulative income share on the y-axis. If everyone had exactly the same income, the curve would be the 45° equality line.

    The Gini coefficient is:

    G = 1 − 2 × (area under the Lorenz curve).

    The calculator above computes the Lorenz curve points and then estimates area with the trapezoid rule, which is exact for stepwise cumulative points.

    Step-by-step example

    Imagine five incomes: 10, 20, 30, 40, 100.

    • Sort values (already sorted).
    • Total = 200.
    • Compute cumulative shares and population shares.
    • Build Lorenz points: (0,0), (0.2,0.05), (0.4,0.15), (0.6,0.30), (0.8,0.50), (1,1).
    • Find area under curve and convert to Gini.

    You will get a positive Gini showing inequality because the top earner has a much larger share than others.

    Interpreting your result

    There is no universal cutoff, but this rough guide is commonly used for intuition:

    • 0.00–0.24: very low inequality
    • 0.25–0.39: moderate inequality
    • 0.40–0.54: high inequality
    • 0.55+: very high inequality

    Interpretation depends on context. Country-level annual income data, city-level wages, and wealth distributions are not directly comparable without care.

    Practical notes and caveats

    1) Sample size matters

    Very small samples can produce unstable Gini values. If possible, use larger samples or compare confidence intervals.

    2) Negative values

    This calculator expects non-negative inputs. While advanced methods can handle negatives, interpretation gets tricky and may require normalization choices.

    3) Same Gini, different distributions

    Two datasets can share the same Gini coefficient but have very different shapes. That is why Lorenz curves and percentile tables are useful companions.

    4) Scale independence

    If every value doubles, the Gini coefficient stays the same. Gini captures relative inequality, not absolute level.

    When to use Gini vs. other inequality metrics

    • Use Gini for a single headline inequality statistic.
    • Use Theil index when decomposability by subgroups matters.
    • Use Palma ratio when you care specifically about top vs. bottom tails.
    • Use percentile ratios (e.g., P90/P10) for communication with broader audiences.

    Quick workflow for analysts

    1. Clean data and keep non-negative values for the variable of interest.
    2. Check outliers and missing values.
    3. Compute Gini and a Lorenz curve.
    4. Report sample size, period, geography, and unit definitions.
    5. Compare against prior periods or benchmark groups.

    Used properly, the Gini coefficient is a compact and powerful summary that helps you track how evenly (or unevenly) outcomes are distributed.

    🔗 Related Calculators