Sales Tax Calculator Formula

Understand the math behind the sales tax calculator. Each variable explained with a worked example.

Formulas Used

Sales Tax

tax_amount = price * tax_rate / 100

Total Price

total_price = price + tax_amount

Variables

VariableDescriptionDefault
pricePrice Before Tax(USD)50
tax_rateSales Tax Rate(%)8.25

How It Works

How Sales Tax Is Calculated

Tax = Price × Tax Rate / 100

Total = Price + Tax

Worked Example

A $50 purchase with 8.25% sales tax.

price = 50tax_rate = 8.25
  1. 01Tax = $50 × 8.25% = $4.13
  2. 02Total = $50 + $4.13 = $54.13

Ready to run the numbers?

Open Sales Tax Calculator