NewConnect Claude, Gemini, ChatGPT, and other AI agents to API Ninjas via our MCP server

Sales Tax Calculator API

The Sales Tax Calculator API provides accurate and detailed sales tax calculations for any purchase amount in the United States, including tax breakdowns and total amounts.

To only get sales tax rate information, please use the Sales Tax API.

(4.7)

From 6,867 users

2,700+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
278ms308ms369ms584ms1081ms

Didn't find what you were looking for? Suggest an improvement


/v1/salestaxcalculator GET

https://api.api-ninjas.com/v1/salestaxcalculator

Calculates sales tax for a given amount and location. Returns a detailed breakdown including state, county, city, and special district taxes, along with the calculated tax amount and total amount after tax.

Parameters

amount is required, and exactly one of the following must be set: zip_code or (city + state)

  • amount  required

    Purchase amount to calculate tax on.

  • zip_code  optional

    Valid US ZIP code.

  • street_address  optional

    Street address (e.g. 9641 Sunset Blvd). Used together with city and state for the most accurate lookup.

  • city  optional

    City name.

  • state  optional

    State name.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON array of objects, each containing the following fields, or an error if the request is unsuccessful.

  • street_address

    The street address from the request. Only returned when the street_address parameter is provided.

  • zip_code

    The ZIP code for which tax information is returned.

  • state_rate

    State sales tax rate as a decimal.

  • city_rate premium only

    City sales tax rate as a decimal.

  • county_rate premium only

    County sales tax rate as a decimal.

  • additional_rate premium only

    Additional special district sales tax rate as a decimal. Some local governments may have multiple additional rates, in which case this field will contain the sum of all additional rates.

  • total_rate premium only

    Total combined sales tax rate of state, county, city, and additional rates as a decimal.

  • state_tax

    The calculated state sales tax amount.

  • city_tax premium only

    The calculated city sales tax amount.

  • county_tax premium only

    The calculated county sales tax amount.

  • additional_tax premium only

    The calculated additional special district sales tax amount.

  • total_tax premium only

    The total calculated sales tax amount.

  • total_price premium only

    The total amount including tax.

Sample Request Live Demo!

street_address
zip_code
amount
city
state

Try this endpoint live with a free API key

Instant access — no credit card required.

https://api.api-ninjas.com/v1/salestaxcalculator?amount=100&zip_code=90210&street_address=9641%20Sunset%20Blvd

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON
[
    {
      street_address:"9641 Sunset Blvd",
      zip_code:"90210",
      pre_tax_amount:"100",
      state_rate:0.06,
      total_rate:0.0975,
      city_rate:0.01,
      county_rate:0.0025,
      additional_rate:0.025,
      state_tax:6,
      city_tax:1,
      county_tax:0.25,
      additional_tax:2.5,
      total_tax:9.75,
      total_price:109.75
    }
]

Code Examples

1 2 curl -X GET "https://api.api-ninjas.com/v1/salestaxcalculator?zip_code=90210&amount=100" \ -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.

Frequently Asked Questions

  • Yes, but you must have a premium subscription. Commercial use of the Sales Tax Calculator API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.
  • Sign up for a free account to instantly get your API key, then pass it in the X-Api-Key header on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.
  • 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.
  • 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.
  • Set the required amount parameter to the purchase price, then specify a location with either zip_code or the combination of city and state; you can also pass street_address alongside city and state for the most accurate lookup. If you only need rate information without a calculation, use the Sales Tax API instead.
  • Each result returns a full breakdown including state_rate, city_rate, county_rate, and additional_rate, plus the calculated state_tax, city_tax, county_tax, additional_tax, total_tax, and the total_price after tax. Most detailed fields beyond the state-level data are premium only.
  • It is ideal for e-commerce checkout flows, point-of-sale systems, and invoicing tools that need accurate US sales tax on a purchase amount for any region, including state, county, city, and special district taxes. Pair it with the Income Tax Calculator or Mortgage Calculator to build a broader suite of financial tools.
  • Yes, the additional_rate field captures special district sales tax, and when a local government has multiple additional rates it returns the sum of all of them, which is also reflected in additional_tax and the combined total_rate. See our APIs for related financial endpoints.