<p>Calculation procedure is here: <a href="https://docs.cardano.org/explore-cardano/fee-structure" rel="nofollow noreferrer">Cardano fee structure</a></p>
<blockquote>
<p>The formula for calculating minimal fees for a transaction (tx) is a * size(tx) + b, where:</p>
<ul>
<li>a/b are protocol parameters</li>
<li>size(tx) is the transaction size in bytes</li>
</ul>
</blockquote>
<p>Where protocol parameters are (as of November 11, 2021):</p>
<ul>
<li>a: <strong>txFeePerByte</strong> = 44 lovelace</li>
<li>b: <strong>txFeeFixed</strong>   = 155381 lovelace</li>
</ul>
<p>You can find those parameters using:</p>
<ul>
<li><code>cardano-cli query protocol-parameters --testnet-magic 1097911063 --out-file protocol-params.json</code></li>
<li><a href="https://adapools.org/protocol-parameters" rel="nofollow noreferrer">Protocol params</a></li>
</ul>

CC BY-SA 4.0
2021-11-09T18:02:42.833Z
I meant documentation on the calculation itself. How are the fees determined. Is there a fixed part and a variable part ?; How high is the fixed part ?; Does the variable part depend on the byte-size of the transaction ?; How high are the costs per byte ?; How large (in bytes) as a transaction with some plain vanilla UTxOs ?; How large is a UTxO with some native assets ? ... and so on.
Jey
CC BY-SA 4.0
2021-11-09T18:31:37.047Z
Check the updated answer.
georgeos
CC BY-SA 4.0
2021-11-10T23:08:11.960Z
Thank you, this is helpful. Can I suggest you add the values of txFeePerByte and txFeeFixed at the time of writing to your response. I think, I can then accept it as the answer.
Jey
CC BY-SA 4.0
2021-11-11T00:16:50.603Z
Done, glad to help!
georgeos
CC BY-SA 4.0
2021-11-11T06:14:37.647Z
But.. we can only know the size once that we said  the outputs right? ... so how can I calculate the real fee incluiding the output to wich i am going to be sending the change if i dont know the fee yet? I ask because calculating the fee with cardanoserialization lib TxBuilder.add_change_is needed() is taking too long to run in the browser and i wanted to calculate manually the fees
Alicia Basilio
CC BY-SA 4.0
2021-11-11T06:16:58.810Z
In fact in the function TxBuilder.add_change_is needed()  there is one warning saying : The minimal fee may not be the real fee! :s
Alicia Basilio
CC BY-SA 4.0
2021-11-11T16:14:47.943Z
I haven't used cardano-serialization-lib but I guess should be same process as here: https://cardano.stackexchange.com/revisions/4473/2
georgeos
CC BY-SA 4.0
2021-11-11T18:16:51.623Z
The byte size of the fees and the output values are probably constant. So you can calculate the fees and than adjust the values accordingly without impacting the size of the transaction.
Jey
CC BY-SA 4.0
2021-11-09T15:28:31.267Z
2021-11-11T00:12:39.033Z
2021-11-11T00:12:39.033Z
georgeos
<p>Is there documentation for the calculation of transaction fees with examples and real parameter values somewhere ?  Maybe something similar to the one on the minimum Ada value here: <a href="https://docs.cardano.org/native-tokens/minimum-ada-value-requirement" rel="nofollow noreferrer">https://docs.cardano.org/native-tokens/minimum-ada-value-requirement</a></p>

<fee><tx>
Calculation of transaction fees
# Calculation of transaction fees

(Asked by: username_0 on 2021-11-09)

Is there documentation for the calculation of transaction fees with examples and real parameter values somewhere ? Maybe something similar to the one on the minimum Ada value here: <https://docs.cardano.org/native-tokens/minimum-ada-value-requirement>

**Tags:** fee, tx

---

## 1 answers

### Answer by username_1 on 2021-11-09. Score: 3 | Accepted answer

Calculation procedure is here: [Cardano fee structure](https://docs.cardano.org/explore-cardano/fee-structure)

> The formula for calculating minimal fees for a transaction (tx) is a \* size(tx) + b, where:
>
> * a/b are protocol parameters
> * size(tx) is the transaction size in bytes

Where protocol parameters are (as of November 11, 2021):

* a: **txFeePerByte** = 44 lovelace
* b: **txFeeFixed** = 155381 lovelace

You can find those parameters using:

* `cardano-cli query protocol-parameters --testnet-magic 1097911063 --out-file protocol-params.json`
* [Protocol params](https://adapools.org/protocol-parameters)

> **Comments:**
> **username_0**: I meant documentation on the calculation itself. How are the fees determined. Is there a fixed part and a variable part ?; How high is the fixed part ?; Does the variable part depend on the byte-size of the transaction ?; How high are the costs per byte ?; How large (in bytes) as a transaction with some plain vanilla UTxOs ?; How large is a UTxO with some native assets ? ... and so on.  
> **username_1**: Check the updated answer.  
> **username_0**: Thank you, this is helpful. Can I suggest you add the values of txFeePerByte and txFeeFixed at the time of writing to your response. I think, I can then accept it as the answer.  
> **username_1**: Done, glad to help!  
> **username_2**: But.. we can only know the size once that we said  the outputs right? ... so how can I calculate the real fee incluiding the output to wich i am going to be sending the change if i dont know the fee yet? I ask because calculating the fee with cardanoserialization lib TxBuilder.add_change_is needed() is taking too long to run in the browser and i wanted to calculate manually the fees  
> **username_2**: In fact in the function TxBuilder.add_change_is needed()  there is one warning saying : The minimal fee may not be the real fee! :s  
> **username_1**: I haven't used cardano-serialization-lib but I guess should be same process as here: https://cardano.stackexchange.com/revisions/4473/2  
> **username_0**: The byte size of the fees and the output values are probably constant. So you can calculate the fees and than adjust the values accordingly without impacting the size of the transaction.  

---

