# VAT and tax base calculation

> How eKasa calculates VAT and the tax base from receipt items: line amount, rounding and totals by VAT rate.

Source: https://ekasa.ninedigit.sk/en/docs/vat-calculation

## How VAT and the tax base are calculated

### 1. Line amount

For each receipt item, the line amount including VAT is calculated by multiplying the quantity (the `quantity`
property, which can be given with up to 4 decimal places) by the unit price including VAT (the `unitPrice` property,
which can be given with up to 6 decimal places). The product is rounded mathematically to 2 decimal places (so 0.005
is rounded to 0.01).

### 2. Total amount including VAT

The line amounts calculated in the previous step are then added up. No rounding happens in this step, because the
partial line amounts being added are already rounded. This gives the total turnover at the given VAT rate,
including VAT.

**Adjusted total when a single-purpose voucher (SPV) is used**

If the value of goods purchased at a given VAT rate is lower than the value of the voucher at that VAT rate,
the total for that VAT rate is zero (not negative), because the difference from the voucher value cannot be paid
out.

### 3. VAT amount and tax base

From the total turnover at the given VAT rate, the VAT amount is then calculated as:

$$
\text{VAT} = \frac{\text{total of items with the same VAT rate} \times \text{VAT rate}}{100 + \text{VAT rate}}
$$

and the VAT base as:

$$
\text{VAT base} = \text{total of items with the same VAT rate} - \text{VAT for that VAT rate}
$$

Before the base is calculated, VAT is rounded to cents according to § 26 of Act No. 222/2004 Coll. on Value Added
Tax: below €0.005 down, from €0.005 inclusive up.

You can try the calculation in the Excel file
[ekasa-vypocet-dph.xlsx](https://ekasa.ninedigit.sk/files/ekasa-vypocet-dph.xlsx) with the current VAT rates.

## Examples

The examples are based on the methodological guidelines of the Financial Administration, with the amounts
recalculated to the VAT rates valid from 1 January 2025 (23 %, 19 % and 5 %). eKasa follows these guidelines, and its
calculations agree with the examples below.

### Example 1: one VAT rate

| Item | VAT rate | Price incl. VAT |
|---|---:|---:|
| Item 1 | 23 % | €5.86 |
| Item 2 | 23 % | €5.27 |

All items have the same rate, so VAT is calculated from the receipt total using the formulas above:

| VAT rate | Total incl. VAT | VAT before rounding | VAT | VAT base |
|---|---:|---:|---:|---:|
| 23 % | €11.13 | €2.0812… | **€2.08** | **€9.05** |

### Example 2: several VAT rates

| Item | VAT rate | Price incl. VAT |
|---|---:|---:|
| Item 1 | 23 % | €5.86 |
| Item 2 | 23 % | €5.27 |
| Item 3 | 19 % | €4.05 |
| Item 4 | 19 % | €3.45 |

The items are added up separately for each rate (23 %: 5.86 + 5.27, 19 %: 4.05 + 3.45), and VAT and the base are calculated from these totals:

| VAT rate | Total incl. VAT | VAT before rounding | VAT | VAT base |
|---|---:|---:|---:|---:|
| 23 % | €11.13 | €2.0812… | **€2.08** | **€9.05** |
| 19 % | €7.50 | €1.1975… | **€1.20** | **€6.30** |
