Vat net gross convert
vat-net-gross-convert · version 1.0.0 · Money & pricing · free, no key needed
Convert a net or gross amount at a VAT rate into a net, VAT and gross triple that adds up exactly at currency precision.
Use when you need to: add 20% VAT to 100 euros · how much VAT is included in 120 gross at 20 percent · remove VAT from a price including 23% VAT.
Decide before calling
Read the versioned contract and the supported scope below. Reuse vat-net-gross-convert@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use vat-net-gross-convert@1.0.0 for add 20% VAT to 100 euros. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- add 20% VAT to 100 euros
- how much VAT is included in 120 gross at 20 percent
- remove VAT from a price including 23% VAT
- net to gross calculation with VAT rounding
- reverse VAT calculation from a gross total
- VAT fraction 1/6 calculator
- credit note VAT amount half up rounding
- split gross price into net and VAT for a currency
Not supported
- looking up the VAT rate of a country or product category
- multi-line invoices or several VAT rates at once
- reverse charge, exemptions or OSS rules
- compound or cascading taxes
Behavior
- net_to_gross: net = amount, vat = round(net x rate_percent / 100), gross = net + vat. gross_to_net: gross = amount, vat = round(gross x rate_percent / (100 + rate_percent)), net = gross - vat. The rounding is applied once, to the VAT, on the exact rational, so net + vat = gross always holds exactly; net is never derived by a separate division.
- Examples: net 100.00 at 20% gives vat 20.00 and gross 120.00; gross 120.00 at 20% gives vat 20.00 (the "VAT fraction" 1/6); gross 10.00 at 20% half_even gives vat 1.67 and net 8.33; net 696.22 at 25% half_up gives vat 174.06 (174.055 is a tie); net -7612.50 at 19% half_up gives vat -1446.38.
- amount is a signed decimal string (negative for credit notes) and must be a multiple of the minor unit by value ("12.500" is fine at scale 2, "12.505" is invalid_input, reason excess_precision). rate_percent is a non-negative decimal from 0 to 100 inclusive (above 100 is invalid_input, reason rate_out_of_range); rate 0 gives vat 0 and the output rate_percent is canonical ("20.00" gives "20").
- Exactly one of currency (active ISO 4217 code with a minor unit, case-insensitive) or scale (0..18) is required; unknown, historic and minor-unit-less codes are unsupported_input. rounding is required, with the ten modes half_even, half_up (ties away from zero), half_down, half_ceiling, half_floor, up, down, ceiling, floor and unnecessary (an inexact VAT is not_computable, reason rounding_necessary).
- Outputs have exactly scale fraction digits and never "-0"; vat has the sign of the amount. Decimal strings over 62 characters are limit_exceeded (before syntax); more than 60 digits or 40 fraction digits is invalid_input.
- Data is the pinned ISO 4217 snapshot named by data_version; no clock, locale or network. The tool holds no VAT rates.
- Disclaimer: arithmetic calculation only; not financial, tax, legal, or investment advice.
Input
amount(string, required): min length 1; max length 62; pattern^-?(0|[1-9][0-9]*)(\.[0-9]+)?$; Net amount (net_to_gross) or gross amount (gross_to_net); at most the currency/scale precision by value.direction(one of "net_to_gross", "gross_to_net", required)rate_percent(string, required): min length 1; max length 62; pattern^(0|[1-9][0-9]*)(\.[0-9]+)?$; VAT rate in percent, 0 to 100 inclusive (20 means 20%).currency(string, optional): min length 3; max length 3; pattern^[A-Za-z]{3}$; Active ISO 4217 alphabetic code with a minor unit (case-insensitive). Give exactly one of currency or scale.scale(integer, optional): min 0; max 18; Fraction digits for non-ISO units. Give exactly one of currency or scale.rounding(one of "half_even", "half_up", "half_down", "half_ceiling", "half_floor", "up", "down", "ceiling", "floor", "unnecessary", required)
Output
net(string, required): min length 1; max length 400; pattern^-?(0|[1-9][0-9]*)(\.[0-9]+)?$; Net amount at exactlyscalefraction digits.vat(string, required): min length 1; max length 400; pattern^-?(0|[1-9][0-9]*)(\.[0-9]+)?$; VAT amount, same sign convention as the amount.gross(string, required): min length 1; max length 400; pattern^-?(0|[1-9][0-9]*)(\.[0-9]+)?$; net + vat, exact.rate_percent(string, required): min length 1; max length 62; pattern^(0|[1-9][0-9]*)(\.[0-9]+)?$; Canonical rate: no trailing fraction zeros ("20.00" -> "20", "7.50" -> "7.5").currency(string or null, required): pattern^[A-Z]{3}$scale(integer, required): min 0; max 18data_version(constant "iso4217-datasets-7cdc784-2026-07-27", required)
Limits
- max decimal chars: 62
- max decimal digits: 60
- max fraction digits: 40
- max scale: 18
- max rate percent: 100
Example
Request input:
{
"amount": "100.00",
"direction": "net_to_gross",
"rate_percent": "20",
"currency": "EUR",
"rounding": "half_up"
}
Response:
{
"result": {
"net": "100.00",
"vat": "20.00",
"gross": "120.00",
"rate_percent": "20",
"currency": "EUR",
"scale": 2,
"data_version": "iso4217-datasets-7cdc784-2026-07-27"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "vat-net-gross-convert",
"version": "1.0.0",
"input": {
"amount": "100.00",
"direction": "net_to_gross",
"rate_percent": "20",
"currency": "EUR",
"rounding": "half_up"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/vat-net-gross-convert/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"amount":"100.00","direction":"net_to_gross","rate_percent":"20","currency":"EUR","rounding":"half_up"}'
The machine-readable contract is at /v1/tools/vat-net-gross-convert/versions/1.0.0.
CLI
node cli.mjs run vat-net-gross-convert 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Money convert at rate: Convert an amount between two ISO 4217 currencies at a caller-supplied rate with explicit quote direction and rounding.
- Price margin compute: Solve cost, price, profit, gross margin and markup from any two of cost, price, margin percent or markup percent.
- Discount stack apply: Apply an ordered stack of percent and fixed-amount discounts to a price, rounding each step or only at the end.
- Invoice totals compute: Compute invoice line nets, tax breakdown by rate and totals with per-line or per-rate rounding, net or gross prices.
- Tiered price compute: Compute a total price for a quantity under graduated or volume tiers with inclusive bounds and optional flat fees.
- Decimal divide: Divide two decimal strings exactly, rounding the quotient once to a fixed scale, and report the exact remainder.