Fee
How bitcoin transaction fees work: the fee is the inputs minus the outputs, and the fee rate in sat/vB decides which transactions a miner includes.
By Dimitar Zurnov · Updated 4 Nov 2026
Adapted from Learn Me a Bitcoin by Greg Walker.
A transaction fee is what is left over when you subtract a transaction's outputs from its inputs. The miner who includes the transaction in a block keeps that amount. The fee rate, the fee divided by the transaction's size in virtual bytes, decides which transactions fit when there is not enough room for all of them. It is written in satoshis per virtual byte, or sat/vB.
How is the fee calculated?
A transaction has no fee field. The fee is simply the value of the inputs minus the value of the outputs, so any amount you do not pay out is paid to the miner.
Take transaction 82b81a39…. It has one input and two outputs:
input 0 2,699,815 sats
output 0 1,593,900 sats
output 1 1,060,915 sats
fee 45,000 sats
The two outputs add up to 2,654,815 sats, and 2,699,815 minus 2,654,815 is 45,000. The figure in the diagram is drawn to scale, so the fee is only a sliver of the input.
This is also a trap. If a wallet or script builds a transaction by hand and gets the change amount wrong, the difference goes to the miner. Transaction cc455ae8… paid a fee of 291.2409 BTC. Its 13 inputs held 291.241 BTC, but its only output was 0.0001 BTC, so almost all of the value went to the miner. Always check the output amounts before you sign.
Why do miners collect fees?
Miners claim their rewards through the coinbase transaction in each block they mine. That claim can include the block subsidy plus every fee from the transactions in the block. Since block 840,000 the subsidy has been 3.125 BTC, so the fees are the part of the reward that changes with demand.
Because a miner can only fit so many transactions in a block, the miner wants the ones that pay the most. A fee is therefore a bid for a place in the next block.
What is a fee rate?
A fee rate is the fee divided by the size of the transaction. Size is measured in virtual bytes, which account for the SegWit discount. A small transaction that pays a large fee beats a large one that pays the same fee, because it uses less of the block.
Two transactions from block 580,004 show why the virtual size matters:
| Transaction | Fee | Size | Virtual size | sat/byte | sat/vB |
|---|---|---|---|---|---|
| a04c291e… (legacy) | 15,977 sats | 223 bytes | 223 vB | 72 | 72 |
| 7169e93e… (SegWit) | 10,317 sats | 226 bytes | 143.5 vB | 46 | 72 |
Both paid 72 sat/vB, rounded to the nearest whole number. Measured in plain bytes, the SegWit transaction looks as if it paid only 46, because its witness data is counted at a discount. Virtual bytes put the two on the same scale. The size page explains where the 143.5 comes from.
Older tools still quote sat/byte. For a SegWit transaction that figure is misleading, so compare fee rates in sat/vB.
How does a miner pick transactions?
Each block can hold 4,000,000 weight units, which is 1,000,000 virtual bytes. A node keeps unconfirmed transactions in its mempool. When a block is built, the miner takes the transactions with the highest fee rates first and keeps adding until the space runs out.
When many transactions compete, the bar to get into the next block rises, and waiting times grow. When demand is low, even a low fee gets in quickly. If everything waiting fits in the next block, there is no competition, and a fee at the minimum is enough. Each block takes about ten minutes on average, so a transaction can wait several blocks in a busy period.
What is the minimum fee?
Every node has a minimum relay fee. It is a policy each node sets for itself, not a rule of consensus. A node will not accept or relay a transaction below that rate. Since Bitcoin Core 29.1, the default is 0.1 sat/vB, or 100 sat per kilovirtual byte, set in its policy code. Bitcoin Core 29.0 and earlier used 1 sat/vB.
The minimum can also rise. When a node's mempool is full, it raises the fee needed to get in. bitcoin-cli getmempoolinfo shows the current minimum for your node in its mempoolminfee and minrelaytxfee fields.
A miner who runs their own policy may include a transaction below a node's minimum. In practice most transactions reach a miner only through nodes that relay them, so set a fee above the current minimum.
How do you raise a fee that is too low?
If a transaction sits in the mempool for too long, you can pay more to move it up the line. There are two ways:
- Replace-by-fee (RBF) sends a new version of the same transaction with a higher fee. The old version drops out of the mempool. Bitcoin Core nodes have accepted replacements of any transaction by default since version 28.0 (full RBF). Signalling with a sequence number of
fffffffdor lower (see sequence) is still what some wallets look for before they offer a fee bump. - Child pays for parent (CPFP) spends an unconfirmed output in a new transaction with a high fee. The miner must take both, so the combined fee rate becomes attractive.
The stuck transactions guide walks through both methods and when each one works.
How do you pick a fee before you send?
Check the current rates before you send. Our home page shows what the next block is taking, read from our own node. Pick a rate that fits the next block or two if you are in a hurry, and a lower one if you can wait. Leave replace-by-fee turned on in your wallet, so you can bump the fee later if the rate was too low.
Summary
The fee is the input value you do not pay to any output, and it goes to the miner. The fee rate, in sat/vB, decides which transactions fit into a block. Compare fee rates in virtual bytes, check your change amounts, and keep a way to raise the fee if the network gets busy.
Sources
- BIP 125: opt-in replace-by-fee defines the original RBF rules.
- Bitcoin Core mempool replacement policy describes how a node decides whether to accept a replacement.
- Bitcoin Core policy constants sets the default minimum relay fee.
- Bitcoin Core 29.1 release notes lower the default minimum relay fee to 100 sat/kvB.
In this section: Transactions
Something look wrong? Tell us