Figuring out Price Before Tax

This post is more than 18 months old. Since technology changes to rapidly, this content may be out of date (but that's not always the case). Please remember to verify any technical or programming information with the current release.

A lot of the time I give quotes including taxes. Every once in a while, someone is curious about what the tax is on a service.

I was messing around the other day and came up with this Javascript function. It takes in the total amount, the tax in percent, and returns the cost before tax.

function figureBeforeTax(amount, tax)
  return Math.round((amount)*(100 / (100 + ((tax/100)*100)))*100)/100;

Return to All Posts