> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lerian.studio/llms.txt
> Use this file to discover all available pages before exploring further.

# Running a Fee Estimation

> Use the Fee Calculator to estimate how fees will apply before running real Transactions in your Ledger.

Use the **Fee Calculator** in Midaz Module to estimate fee calculations before processing real transactions. This helps you validate fee packages and understand how fees will be applied.

<Warning>
  You must have at least one [Fee Package](/en/platform/lerian-console/midaz-console/fe-creating-a-package) created before using the Fee Calculator. The estimator requires selecting a fee package to test against.
</Warning>

## Running an estimation

***

<Steps>
  <Step>
    Go to the **Calculator** page in the Fees Engine section.
  </Step>

  <Step />

  <Step>
    Configure the estimated transaction:

    * **Transaction Amount** - The total value to transfer.
    * **Currencry** - The asset code for the transaction (e.g., USD, BRL)
    * **Fee Package** - Select one of the Fee Packages created  from the dropdown.
    * **From Account** - The account alias that will be debited
    * **To Account** - The account alias that will be credited
    * **Description** (optional) - A description for the estimated transaction
  </Step>

  <Step>
    Click **Calculate Fees** to run the estimation.
  </Step>

  <Step>
    Review the results displayed below the form.
  </Step>
</Steps>

<Note>
  The Fee Calculator is a read-only tool. It does not affect the ledger or create any transactions. You can run as many estimations as needed safely.
</Note>

## Understanding the results

***

After running an estimation, you'll see a detailed breakdown of how fees are calculated:

### Summary

* **Total Fee** - The combined amount of all fees that would be charged
* **Net Amount** - The amount the destination would receive after deductible fees

### Fee breakdown

For each fee rule applied, you'll see:

| Field                 | Description                                      |
| --------------------- | ------------------------------------------------ |
| **Fee Label**         | Name identifying the fee                         |
| **Priority**          | Order in which the fee was applied               |
| **Calculation Type**  | `flat` or `percentage`                           |
| **Reference Amount**  | The base amount used for calculation             |
| **Calculated Amount** | The actual fee value                             |
| **Credit Account**    | Account that would receive the fee               |
| **Is Deductible**     | Whether the fee is deducted from the transaction |

## Estimation examples

***

<AccordionGroup>
  <Accordion title="Simple flat fee estimation">
    **Scenario**: Test a \$2.00 flat fee on a \$100 transfer

    **Input**:

    * Fee Package: `Standard Transfer Fee`
    * Asset: `USD`
    * Amount: `100.00`
    * Source: `@customer/checking`
    * Destination: `@merchant/revenue`

    **Expected Result**:

    * Total Fee: \$2.00
    * Net Amount: \$98.00 (if deductible) or \$100.00 (if not deductible)
  </Accordion>

  <Accordion title="Percentage fee estimation">
    **Scenario**: Test a 1.5% fee on a \$500 transfer

    **Input**:

    * Fee Package: `Percentage Transaction Fee`
    * Asset: `USD`
    * Amount: `500.00`
    * Source: `@customer/savings`
    * Destination: `@vendor/payments`

    **Expected Result**:

    * Total Fee: \$7.50 (1.5% of \$500)
    * Calculation: 500 × 0.015 = 7.50
  </Accordion>

  <Accordion title="Combined fee estimation">
    **Scenario**: Test max(flat, percentage) fee on different amounts

    **Test 1** - Small transaction (\$30):

    * Flat: \$1.00
    * Percentage: 2% = \$0.60
    * Result: \$1.00 (flat is higher)

    **Test 2** - Large transaction (\$200):

    * Flat: \$1.00
    * Percentage: 2% = \$4.00
    * Result: \$4.00 (percentage is higher)
  </Accordion>

  <Accordion title="Multiple fees estimation">
    **Scenario**: Package with two fees applied in priority order

    **Fee A** (Priority 1): 1% on original amount
    **Fee B** (Priority 2): 0.5% on after fees amount

    **Input**: \$1000 transaction

    **Expected Result**:

    * Fee A: \$10.00 (1% of \$1000)
    * Fee B: \$4.95 (0.5% of \$990)
    * Total Fee: \$14.95
  </Accordion>
</AccordionGroup>

## Use Cases for Fee estimation

***

### Validate new fee packages

Before enabling a new fee package, run estimations with various transaction amounts to ensure fees are calculated correctly across the entire amount range.

### Test edge cases

Estimate transactions at minimum and maximum amount boundaries to verify fee behavior at the limits of your configured ranges.

### Compare fee structures

Run the same transaction through different fee packages to compare outcomes and choose the best structure for your use case.

### Document expected fees

Use simulation results to create documentation for your finance team or customers about expected fee amounts.

### Debug fee issues

If transactions are showing unexpected fees, use the estimator to reproduce the scenario and understand the calculation breakdown.

## Best practices

***

* **Test full amount ranges** - Don't just test one amount; estimate transactions at minimum, maximum, and several points in between.
* **Verify priority ordering** - When packages have multiple fees, confirm they apply in the expected order.
* **Check waived accounts** - Test with accounts that should be waived to confirm they're excluded from fees.
* **Document your tests** - Keep a record of estimation results for audit and compliance purposes.
* **Share with stakeholders** - Use estimation breakdowns to align with finance teams on expected fee outcomes before going live.
