# When should I calculate tax?

Source: https://developer.avalara.com/ecommerce-integration-guide/design-the-document-workflow/when-to-calculate-tax/

Getting a tax calculation is the primary reason developers use AvaTax, and [CreateTransactio](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/CreateTransaction/)n is the starting point.

But when will you collect tax? The answer varies from system to system, but in general, balance between an efficient use of the API and when your application's transaction workflow requires tax. For ecommerce specifically, you'll want to show tax in the checkout workflow, which is after the user has entered their shipping and billing information.

**Note**: Be sure that your system isn’t calling tax every time a line is added or changed because this can drive up usage.

**Advice**: If you need to provide a quote, an easy way to accomplish this is with rate tables. For example, on the client side, you calculate the amount using `zip code × rate` based on the zip rate lookup. The amount × the rate = the estimated tax. More information is available in the [DownloadTaxRatesByZipCode](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/TaxContent/DownloadTaxRatesByZipCode/) API.  

**Advice**: Consider providing an explicit **Calculate tax** button, or simply calculate tax automatically before saving the document.