# Tax rules

Create a tax rule to be associated with a [manual tax calculator](https://docs.commercelayer.io/core-api-reference/manual_tax_calculators). Use the available regular expressions to match the order shipping address and apply the specified `tax_rate` (default is `0`). You can optionally define the tax rule taxable preferences by setting the `freight_taxable`, `payment_method_taxable`, `gift_card_taxable`, and `adjustment_taxable` attributes to `true` (all `false` by default).

{% hint style="info" %}
Manual tax calculators support **location-based** tax rules only, meaning that they can evaluate RegEx (max **5000** chars allowed) to match the shipping address country, state, and zip codes. For any other use case please consider creating an [external tax calculator](https://docs.commercelayer.io/core-api-reference/external_tax_calculators) that handles your own custom tax calculation logic or leveraging our out-of-the-box integrations with [Avalara](https://docs.commercelayer.io/core-api-reference/avalara_accounts), [Stripe Tax](https://docs.commercelayer.io/core-api-reference/stripe_tax_accounts), [TaxJar](https://docs.commercelayer.io/core-api-reference/taxjar_accounts), and [Vertex](https://docs.commercelayer.io/core-api-reference/vertex_accounts).
{% endhint %}

<details>

<summary>Data model</summary>

Check the related [ER diagram](https://commercelayer.io/docs/data-model/tax-calculation) and explore the flowchart that illustrates how the tax rule resource relates to the other API entities.

</details>
