Free tax data as JSON

The tables behind every calculator on this site, published as five JSON files and one CSV table of results. No key, no sign-up and no rate limit: you download a file and do the sums yourself.

How it works

There is no server that calculates anything. Each address below returns one complete file, the same one every time, until we change a tax table. So there are no parameters, no pages of results and no errors to handle beyond the download itself. Fetch a file once, keep your own copy, and check back when a new tax year starts.

GET https://allcountrytaxcalculator.com/api/countries.json
GET https://allcountrytaxcalculator.com/api/us-states.json
GET https://allcountrytaxcalculator.com/api/canada-provinces.json
GET https://allcountrytaxcalculator.com/api/spain-regions.json
GET https://allcountrytaxcalculator.com/api/swiss-cantons.json
GET https://allcountrytaxcalculator.com/api/take-home.csv

Three rules hold in every file. Amounts are yearly and in the local currency. Rates are fractions, so 0.2 means 20%. A limit of null means the band has no top.

countries.json

One record per country, keyed by a short id (us, uk, de and so on). This is the United Kingdom record, shortened only in its note:

{
 "taxYear": 2026,
 "unitsPerUsd": { "USD": 1, "GBP": 0.76, "EUR": 0.92 },
 "countries": {
  "uk": {
   "name": "United Kingdom",
   "code": "GB",
   "cur": "GBP",
   "allow": 12570,
   "allowTaper": 100000,
   "tax": [[37700, 0.2], [125140, 0.4], [null, 0.45]],
   "soc": [[[12570, 0], [50270, 0.08], [null, 0.02]]],
   "note": "England, Wales and Northern Ireland rates with employee National Insurance."
  }
 }
}
FieldMeaning
name, code, curCountry name, ISO 3166 two-letter code and ISO 4217 currency.
taxIncome tax bands as [upper limit, rate] pairs. The limits count taxable income, after the allowance.
socA list of employee social contribution tables in the same format, applied to gross pay. The US has two: Social Security and Medicare.
allowPersonal allowance or standard deduction, taken off income before the bands.
allowTaperIncome above which the allowance shrinks by 1 for every 2 earned.
socDedTrue where contributions are taken off income before tax.
deductPct, deductA share of income, or an amount, taken off before tax.
creditAn amount taken off the tax itself. credit and deduct are either one number or a list of [gross pay, amount] points joined by straight lines.
creditOfTax, surtaxBands applied to the tax, not to income.
surchargeA percentage added to the tax.
rebateBelowTax is zero up to this taxable income.
bonusA share of pay that is taxed on its own scale.
localThe local tax rate already inside the bands, for countries where the town or region sets part of it.
cantonSwitzerland only: the canton the country figure uses. Its numbers are in swiss-cantons.json.
partSet on Scotland, which is part of the UK and not counted as a country.
noteWhat the model covers and what it leaves out. Read it before you rely on a figure.

Most countries only have tax, soc, allow and note. A field that is missing does not apply. unitsPerUsd is how many units of each currency we count as one US dollar. These are fixed round figures for comparing countries, not live exchange rates.

Example in JavaScript

Income tax and National Insurance on a salary of 40,000 pounds in the UK. The bands function works for every [upper limit, rate] table in the files.

const res = await fetch('https://allcountrytaxcalculator.com/api/countries.json');
const { countries } = await res.json();
const uk = countries.uk;

function bands(amount, table) {
  let tax = 0, floor = 0;
  for (const [limit, rate] of table) {
    const top = limit === null ? amount : Math.min(amount, limit);
    if (top > floor) tax += (top - floor) * rate;
    if (limit === null || amount <= limit) break;
    floor = limit;
  }
  return tax;
}

const salary = 40000;
const incomeTax = bands(Math.max(0, salary - uk.allow), uk.tax);            // 5486
const insurance = uk.soc.reduce((sum, t) => sum + bands(salary, t), 0);     // 2194.40
const takeHome = salary - incomeTax - insurance;                            // 32319.60

The order for a full calculation is: social contributions on gross pay, then the allowance and any deductions, then the tax bands, then credits, rebates and surcharges. The About page lists what the model leaves out.

us-states.json

State income tax for a single filer. Here each bracket gives where it starts, not where it ends. A state with no tax on wages has an empty list.

{
 "taxYear": 2026,
 "filer": "single",
 "states": {
  "ca": { "name": "California", "deduction": 5540,
          "brackets": [{ "from": 0, "rate": 0.01 }, { "from": 11079, "rate": 0.02 }, { "from": 26264, "rate": 0.04 }] },
  "tx": { "name": "Texas", "deduction": 0, "brackets": [] }
 }
}

The California list above is cut short; the file has every bracket. Federal tax is not in this file. It is the us record in countries.json.

Example in Python

import json, urllib.request

url = "https://allcountrytaxcalculator.com/api/us-states.json"
with urllib.request.urlopen(url) as r:
    states = json.load(r)["states"]

def state_tax(state_id, income):
    s = states[state_id]
    taxable = max(0, income - s["deduction"])
    b = s["brackets"]
    tax = 0
    for i, band in enumerate(b):
        top = b[i + 1]["from"] if i + 1 < len(b) else float("inf")
        if taxable > band["from"]:
            tax += (min(taxable, top) - band["from"]) * band["rate"]
    return tax

print(state_tax("ca", 90000))
print(state_tax("tx", 90000))   # 0

canada-provinces.json

Provincial tax only. Apply the brackets to income, then take off the lowest rate times basicPersonalAmount, which is how the basic credit works in Canada. Ontario also charges a surtax on top that is not in the file.

"on": { "name": "Ontario", "basicPersonalAmount": 12989,
        "brackets": [{ "upTo": 53891, "rate": 0.0505 }, { "upTo": 107785, "rate": 0.0915 },
                     { "upTo": 150000, "rate": 0.1116 }, { "upTo": 220000, "rate": 0.1216 },
                     { "upTo": null, "rate": 0.1316 }] }

spain-regions.json

Spanish income tax has two halves: stateScale, the same everywhere, and the scale of the region you live in. Add the two. personalMinimum (5,550 euros) is taxed at the lowest rates of each scale and that amount is taken off the tax. The figures are for income year 2025. The Basque Country and Navarre run their own systems and are not in the file.

{
 "incomeYear": 2025,
 "personalMinimum": 5550,
 "stateScale": [{ "upTo": 12450, "rate": 0.095 }, { "upTo": 20200, "rate": 0.12 }],
 "regions": {
  "md": { "name": "Madrid", "brackets": [{ "upTo": 13362.22, "rate": 0.085 }, { "upTo": 19004.63, "rate": 0.107 }] }
 }
}

swiss-cantons.json

Switzerland is the one place we do not use bands, because each canton and commune has its own formula. The file holds results from the Swiss Federal Tax Administration's calculator for the capital of each canton, at 16 salaries. Every list lines up with grossSalary: the third number in a list belongs to the third salary.

{
 "taxYear": 2026,
 "grossSalary": [20000, 30000, 40000, 50000, 60000, 80000, 100000],
 "federalTax": [0, 67, 136, 213, 411, 906, 1701],
 "socialAndPension": [ ... ],
 "cantons": {
  "zh": { "name": "Zurich", "capital": "Zurich",
          "cantonalAndCommunalTax": [251, 1060, 1970, 3040, 4246, 7039, 10147] }
 }
}

The lists above show the first seven of 16 values. For a salary between two points, read along a straight line between them. Total deductions are the federal tax, the cantonal and communal tax, and social insurance with pension, added together.

take-home.csv

One row per country, worked out with the same functions as the calculators, so you can use the figures without redoing the sums. It opens in any spreadsheet. Shares and rates are fractions here too.

ColumnMeaning
id, country, currency, units_per_usdThe same id as in countries.json, the name, the currency and our fixed rate to the US dollar.
gross_30k_usd_local and the 60k and 120k columnsA salary worth about USD 30,000, 60,000 or 120,000, in local money, rounded to two figures.
take_home_…, share_taken_…Take-home pay at that salary for a single employee, and the share lost to income tax and employee contributions.
trap_from_local, trap_to_localThe salary range where a raise loses more than it does at about USD 1,000,000. Empty where there is none. See tax traps by country.
trap_rate_on_raiseThe highest share of a raise lost in that range. Empty for a step in the tax table, where take-home pay falls as pay rises.
rate_on_raise_at_topThe share of a raise lost at about USD 1,000,000.

Using it from a web page

A script on a server, or a program on your computer, can fetch the files from anywhere. A page on another website can only read them in the browser if our host allows requests from other sites. The simple way round that is to download the file and serve your own copy.

When the files change

We update them when a country publishes new rates, usually around the start of its tax year. The field names above will stay. New fields may be added, so ignore any you do not know.

Terms

Free for personal and commercial use. A link back to AllCountryTaxCalculator.com is appreciated. The data is a simplified model for estimates and comes with no guarantee of accuracy. Do not use it to file a tax return. See the disclaimer.