Calculating a Cardano transaction fee?

Fees are constructed around two constants (a and b).

The formula for calculating minimal fees for a transaction (tx) is: a * size(tx) + b
Where ‘a’ and ‘b’ are protocol parameters, and size(tx) is the transaction size in bytes.

The a and b protocol parameters (minFeeA and minFeeB) can be found at: https://cardanoscan.io/protocolparams

Calculating the total ADA required for a transaction

In addition to the transaction fee, Cardano also requires a certain amount of ADA to be transferred as part of a transaction. This ADA isn’t lost, the recipient receives it into their wallet. It is primarily a security measure to deter spam and malicious users from creating large number of UTxOs and bloating the ledger.

The minimum ADA cost for a UTxO (transaction)is commonly referred to as “min ADA” and it comprises of the transaction cost and the minimum ADA requirement by multiplying the size with “ADA Per UTXO Byte” protocol parameter.