Income Tax Calculator API
The Income Tax Calculator API provides detailed tax calculations for the United States and Canada. Annual tax calculation supports federal, state/provincial, and FICA. Per-paycheck calculation uses IRS Publication 15-T W-4 worksheets and supports both the 2020-or-later and pre-2020 W-4 forms.
Available endpoints:
- /v1/incometaxcalculator - Calculate annual income taxes by income and location
- /v1/paycheckwithholding - Calculate per-paycheck federal/state/FICA withholding from W-4 inputs
Only interested in getting current and historical income tax rates? Check out our Income Tax API.
From 2,366 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 314ms | 348ms | 392ms | 580ms | 1081ms |
Didn't find what you were looking for? Suggest an improvement
/v1/incometaxcalculator GET
https://api.api-ninjas.com/v1/incometaxcalculator
Returns comprehensive annual tax calculations including federal, state/provincial, and FICA taxes where applicable.
Parameters
countryrequired2-letter country code (e.g., US, CA)
regionrequiredState/province code (e.g., CA, NY, ON)
incomerequiredAnnual income amount
tax_yearoptionalTax year in YYYY format (e.g.,
2026). If not specified, the latest year will be used.filing_statusrequired for USTax filing status. Possible values:
single,married(married filing jointly),married_separate(married filing separately), orhead_of_householddeductionsoptionalTotal tax deductions amount
creditsoptionalTotal tax credits amount
self_employedoptionalSet to true for self-employed tax calculations (US only)
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields or an error if the request is unsuccessful.
countryThe country code used in the calculation.
regionThe state/province code used in the calculation.
incomeThe annual income amount.
taxable_incomeIncome after deductions.
deductionsTotal deductions applied.
creditsTotal tax credits applied.
federal_effective_rateEffective federal tax rate as a decimal.
federal_taxes_owedTotal federal taxes owed.
fica_social_securitypremium onlySocial Security tax amount - US only.
fica_social_security_ratepremium onlySocial Security tax rate as a decimal - US only.
fica_social_security_cappremium onlySocial Security wage base cap - US only.
fica_medicarepremium onlyMedicare tax amount - US only.
fica_medicare_ratepremium onlyMedicare tax rate as a decimal - US only.
fica_totalpremium onlyTotal FICA taxes (Social Security + Medicare taxes) - US only.
region_effective_ratepremium onlyEffective state/provincial tax rate as a decimal.
region_taxes_owedpremium onlyTotal state/provincial taxes owed.
total_taxes_owedpremium onlyTotal taxes owed (federal + state/provincial + FICA).
income_after_taxpremium onlyIncome remaining after all taxes.
total_effective_tax_ratepremium onlyOverall effective tax rate as a decimal.
Sample Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/incometaxcalculator?country=US®ion=CA&income=100000&filing_status=single&tax_year=2026Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/incometaxcalculator?country=US®ion=CA&income=100000&filing_status=single&tax_year=2026" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
/v1/paycheckwithholding GET premium only
https://api.api-ninjas.com/v1/paycheckwithholding
Returns per-paycheck federal withholding, FICA (Social Security, Medicare, Additional Medicare), and optional state withholding given gross pay and W-4 inputs. Federal withholding uses IRS Publication 15-T percentage method tables for both the 2020-or-later and pre-2020 W-4 forms.
Parameters
gross_payrequiredGross pay for the period (in dollars).
pay_periodrequiredOne of:
weekly,biweekly,semimonthly,monthly,quarterly,semiannually,annually,daily.filing_statusrequiredOne of:
single,married(married filing jointly),married_separate,head_of_household.stateoptional2-letter US state code. Omit for federal-only calculation.
tax_yearoptionalTax year (YYYY). Defaults to the current year. Currently supported: 2026.
w4_versionoptional2020_or_later(default) orpre_2020. Selects which W-4 worksheet to use.multiple_jobsoptionalW-4 Step 2(c) "multiple jobs" checkbox (2020+ W-4 only).
trueorfalse. Defaultfalse.dependents_amountoptionalW-4 Step 3 total annual credit for dependents (2020+ W-4).
other_incomeoptionalW-4 Step 4(a) annual other income (2020+ W-4).
deductionsoptionalW-4 Step 4(b) annual deductions over the standard deduction (2020+ W-4).
extra_withholdingoptionalW-4 Step 4(c) extra per-period withholding (added directly to federal withholding).
allowancesoptionalPre-2020 W-4 only. Number of allowances claimed on line 5 of the 2019-or-earlier W-4.
pretax_deductionsoptionalPre-tax deductions for this paycheck (401(k), HSA, cafeteria plans). Reduces taxable wages.
ytd_grossoptionalYear-to-date gross wages before this paycheck. Used to apply the Social Security wage base cap and the 0.9% Additional Medicare tax above $200,000 YTD.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields or an error if the request is unsuccessful.
gross_payGross pay for the period (echoed back).
pay_periodPay period (echoed back).
tax_yearTax year used for the calculation.
filing_statusFiling status used.
w4_versionW-4 worksheet version applied.
pretax_deductionsPre-tax deductions used in the calculation.
taxable_wagesGross pay minus pre-tax deductions.
federal_withholdingFederal income tax withheld for this paycheck (including extra withholding).
fica.social_securitySocial Security tax for this paycheck (6.2% up to the annual wage base).
fica.medicareMedicare tax for this paycheck (1.45%).
fica.additional_medicareAdditional Medicare tax for this paycheck (0.9% on YTD wages above $200,000).
fica.totalSum of all FICA components.
state2-letter state code (echoed back) when state was supplied.
state_withholdingState income tax withheld for this paycheck. 0 for no-tax states.
total_withholdingFederal + FICA + state withholding combined.
take_home_payTaxable wages minus total withholding.
annualizedAnnualized projections: gross, federal withholding, and take-home — extrapolating this paycheck across the year.
Sample Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/paycheckwithholding?gross_pay=5000&pay_period=biweekly&filing_status=single&tax_year=2026Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/paycheckwithholding?gross_pay=5000&pay_period=biweekly&filing_status=single&tax_year=2026" \
-H "X-Api-Key: YOUR_API_KEY"Frequently Asked Questions
Can I use the Income Tax Calculator API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Income Tax Calculator API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Income Tax Calculator API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Income Tax Calculator API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.What are some use cases for the Income Tax Calculator API?
The API powers tax estimators, salary and offer-comparison tools, and payroll previews for the US and Canada: the/v1/incometaxcalculatorendpoint computes annual federal, state/provincial, and FICA liability fromincome,region, andfiling_status, while the/v1/paycheckwithholdingendpoint models per-paycheck take-home pay. If you only need raw current and historical bracket rates instead, see the Income Tax API.How do I calculate annual income tax for a specific person and location?
Call the/v1/incometaxcalculatorendpoint with the requiredcountry(e.g. US or CA),region(state/province code like CA, NY, or ON), andincomeparameters, plusfiling_status(single,married,married_separate, orhead_of_household) which is required for the US. You can refine the result with optionaldeductions,credits,tax_year, andself_employedparameters, or browse our other finance tools in the API catalog.What does the per-paycheck withholding endpoint return, and how is it computed?
The/v1/paycheckwithholdingendpoint computes federal withholding using IRS Publication 15-T percentage method tables (supporting both the2020_or_laterandpre_2020W-4 forms viaw4_version) and returnsfederal_withholding, aficaobject (Social Security, Medicare, and additional Medicare), optionalstate_withholding,total_withholding,take_home_pay, and anannualizedprojection. This endpoint is premium only and accepts W-4 inputs such asdependents_amount,other_income,extra_withholding, andytd_gross.Which response fields are available on the free versus premium plans?
On the annual/v1/incometaxcalculatorendpoint, fields likefederal_taxes_owedandtaxable_incomeare available on all plans, while the FICA breakdown (fica_social_security,fica_medicare,fica_total),region_taxes_owed,total_taxes_owed,income_after_tax, andtotal_effective_tax_rateare premium only. The entire/v1/paycheckwithholdingendpoint also requires a premium subscription.