When executing transactions in Blockchain, they are not being processed for free. All of them are being validated by the miners, who are incentivized for this contribution. This compensation comes in the form of a per transaction fee and a reward in new Bitcoins (12.5 at the time of writing) per new block discovered.
Before confirming the transaction, it is essential for someone to know what the amount of the varying fee would be. It would be sensible for someone to think, that the fee will be in proportion to the transaction total. However, with Bitcoin, this is not the case.
The fee rate is only dependent on the supply and demand in the free market for block space. For example, if a transaction is 250 kilobytes in size (the actual average), the applicable fee will be the same, regardless if you are spending one dollar or a million. In general, a transaction has higher probabilities of being confirmed for a lower fee at times of low demand and lower probabilities during periods of high congestion in the network, respectively.
Each block has a maximum capacity of 1Mb (or 1000kb). This means that only a specific amount of transactions can “fit” inside a block. The rest will remain in the memory pool until they are finally validated in a future block. Otherwise, if a transaction is not validated within a week, it is then rejected by the Blockchain.
Transactions can take from a few minutes to several hours until they are validated and for this reason, spenders are able to speed up the process in exchange for a higher fee. The miners, on the other hand, are able to choose the array of transactions that will be included in a block, by selecting the most profit-efficient solution to their benefit.
If someone tried to calculate the transaction fees manually, they would have to find the size of a transaction (in bytes,) which is derived by the following equation:
148 * number_of_inputs + 34 * number_of_outputs + 10
After that, this number should be multiplied by the median byte size from the latest transactions. This would give the result is Satoshis that should further be divided by 100,000,000 to give the number in Bitcoin.
Fortunately, fees can be calculated automatically directly from the most wallets available. In the case that a wallet does not offer this services, there are numerous online services where someone can find the best solution for the fee-rate/transaction speed ratio.
Bitcoinfees.earn.com - is an online fee prediction tool where someone can find the slowest to the fastest transaction speeds, together with the amount of fee to be paid (in Satoshis)
Estimatefee.com - a calculator that provides with amount of fee, according to the inputs/outputs of the transaction and the desired time of execution
Other online tools are: