The formulas
Add tax: price including tax = price × (1 + rate ÷ 100)
Remove tax: price before tax = price ÷ (1 + rate ÷ 100)
Worked example
At a 20% rate, a price of 100 before tax becomes 120. Going the other way, 120 including tax is 120 ÷ 1.2 = 100 before tax, so the tax is 20.
The usual mistake
Taking 20% off a tax-inclusive price does not remove a 20% tax. 20% of 120 is 24, which would leave 96 instead of the correct 100. Always divide by 1 plus the rate.
Rates and rules differ by country, region and product. Check the rate with your tax authority. This page is general information, not tax advice.