How tax-inclusive and tax-exclusive prices are calculated in WooCommerce?

When a WooCommerce store is configured we also need to configure tax properly. Most of the time we are a bit confused about tax-inclusive and tax-exclusive prices. When we set those options we see that tax-inclusive prices are a bit less compared to tax-exclusive price.

WooCommerce has a defined rule for that. Following are the rules of tax-inclusive and tax-exclusive prices:

Rule for tax-inclusive prices

tax_amount = price - ( price / ( ( tax_rate_% / 100 ) + 1 ) )

Rule for tax-inclusive prices

tax_amount = price * ( tax_rate_% / 100 )

Reference

Setting up Taxes in WooCommerce
How Taxes Work in WooCommerce