VAT and GST calculator
VAT or GST on one amount or a whole invoice, added or taken out of tax-inclusive prices, with the per-rate rounding EN 16931 e-invoices require.
- Version 1
- Checked against 6 published values
- Free, no sign-up
Result: An invoice with two rates (the Peppol example's lines)
| Net total Total without tax. |
7,000.00 exact |
|---|---|
| Tax total Total tax: the sum of the tax of each rate. |
1,250.00 exact |
| Gross total Total with tax: net_total + tax_total. |
8,250.00 exact |
Breakdown
| Rate percent | Net | Tax | Gross |
|---|---|---|---|
| 25 | 5,000.00 | 1,250.00 | 6,250.00 |
| 0 | 2,000.00 | 0.00 | 2,000.00 |
Rounding: Half up, 2 decimal places. Calculator tax/vat@1.
How it is calculated
tax = round(net × rate / 100); from a price with tax: net = round(gross / (1 + rate / 100)), tax = gross − net; per_rate applies this to each rate's sum of lines, per_line to each lineWorks out net, tax and gross for one amount or for every line of an invoice. Give amounts without tax to add it, or set amounts_include_tax to take the tax out of prices that already include it. Lines can have different rates. By default the tax is worked out once for each rate on the sum of that rate's lines and rounded to the cent, which is how the European e-invoice standard EN 16931 (and so XRechnung, Peppol and Factur-X) defines the VAT breakdown. The other choice rounds the tax on each line and adds those up, as a till receipt does; the two can differ by a few cents on a long invoice. The rate can be given, or looked up as a country's standard rate, in which case the answer names the official page it came from.
- Amounts are rounded to the cent (2 decimals) half up by default. Set options.decimals for currencies with other minor units (0 for JPY) and options.rounding for another rule.
- Each line amount is rounded first, because an invoice line has at most two decimals. Net, tax and gross then always add up exactly.
- Which rate applies to a sale, and whether tax is due at all, depends on what is sold, to whom and where. This calculator does the arithmetic for the rates you give.
References
- Peppol BIS Billing 3.0 (EN 16931): calculation of VAT, BT-116 and BT-117
- GOV.UK: VAT rates, working out VAT-inclusive and VAT-exclusive prices
- Australian Taxation Office: GST is one eleventh of the price
Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.
Use it from your code
curl https://api.curatedapi.com/v1/calc/tax/vat \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"amounts": ["4000", "900", "100", "2000"],
"rates_percent": ["25", "25", "25", "0"]
}'
The same call in Python
import os
import requests
payload = {
"amounts": ["4000", "900", "100", "2000"],
"rates_percent": ["25", "25", "25", "0"],
}
response = requests.post(
"https://api.curatedapi.com/v1/calc/tax/vat",
headers={"Authorization": f"Bearer {os.environ['CURATEDAPI_KEY']}"},
json=payload,
timeout=10,
)
print(response.json()["result"])
The same call in JavaScript
const payload = {
"amounts": ["4000", "900", "100", "2000"],
"rates_percent": ["25", "25", "25", "0"],
};
const response = await fetch("https://api.curatedapi.com/v1/calc/tax/vat", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CURATEDAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log((await response.json()).result);
MCP tool calc_tax_vat at https://mcp.curatedapi.com.
Inputs, outputs and errors in the API reference.
Put it on your website
<div data-curatedapi-widget="tax/vat" data-key="capi_public_…"></div>
<script src="https://widgets.curatedapi.com/v1/widget.js" async></script>
Use a public key registered for your site. Calculations are billed like API calls. How widgets work.
Related calculators
Add this calculator to your website
Paste two lines into your page and your visitors get this calculator. Each use counts as one call on your plan, the same as the API.
Free for up to 1,000 uses a month. 50,000 uses a month cost $9.00 on the Starter plan.