Bitcoin transaction fee estimator
Fee = size in virtual bytes (vB) × fee rate (sat/vB). Set your inputs and outputs and see the cost at today's rates.
The vbyte math, explained
Since SegWit, block space is measured in weight units (WU). Bytes outside the witness count 4 WU each and witness bytes count 1 WU each. Virtual size is vsize = ceil(weight ÷ 4), and fee rates are quoted per vbyte (BIP141, transaction size calculations). Witness data (signatures and public keys in SegWit and Taproot inputs) is therefore 75% cheaper. That's why native SegWit and Taproot inputs cost much less than legacy ones.
Fixed overhead: version (4 B) + locktime (4 B) + input count (1 B) + output count (1 B) = 10 vB. If any input is SegWit, the marker and flag add 2 WU (0.5 vB), and each non-SegWit input in that transaction adds 1 WU for its empty witness. Counts above 252 take a 3-byte varint.
Every input carries a 36-byte outpoint (txid + index), a 4-byte sequence and its scriptSig with a length byte. Signatures are assumed to be 72 bytes including the sighash byte (DER ECDSA with low-R grinding is usually 71–72; we use the larger figure). Keys are 33-byte compressed keys, and Taproot key-path signatures are 64 bytes (BIP341, default sighash).
| Input type (current m-of-n for multisig) | vB per input |
|---|---|
| P2PKH (legacy, 1…) | |
| P2SH-P2WPKH (nested SegWit, 3…) | |
| P2WPKH (native SegWit, bc1q…) | |
| P2TR (Taproot key path, bc1p…) | |
| P2SH multisig (legacy, 3…) | |
| P2SH-P2WSH multisig (nested, 3…) | |
| P2WSH multisig (native, bc1q…) |
- P2PKH: 36 + 4 + 1 + (1+72 sig + 1+33 key) = 148 B, all non-witness → 148 vB.
- P2WPKH: 41 B non-witness (164 WU) + witness 1 + 73 + 34 = 108 WU → 272 WU = 68 vB.
- P2SH-P2WPKH: like P2WPKH plus a 23-byte scriptSig holding the redeem script → 91 vB.
- P2TR key path: 164 WU + witness 1 + 65 = 66 WU → 57.5 vB.
- Multisig m-of-n: the witness script is 3 + 34n bytes; the spend carries m signatures plus an empty dummy element (the CHECKMULTISIG bug). 2-of-3 P2WSH = 104.5 vB; 2-of-3 legacy P2SH = 297 vB.
| Output type | vB per output |
|---|---|
| P2PKH (1…) | 34 |
| P2SH (3…) | 32 |
| P2WPKH (bc1q…) | 31 |
| P2WSH (bc1q…, long) | 43 |
| P2TR (bc1p…) | 43 |
An output is an 8-byte amount, a length byte and the script: 25 B for P2PKH, 23 B for P2SH, 22 B for P2WPKH, 34 B for P2WSH and P2TR. You can cross-check every number with the Bitcoin Optech transaction size calculator. Small differences (±1 vB) come from signature-size assumptions.
About the live fee rates
Rates come from mempool.space's recommended fees endpoint (/api/v1/fees/recommended), fetched by your browser. They are estimates based on the current mempool. Blocks are found randomly, so "next block" is a target, not a promise. If your wallet supports Replace-By-Fee you can start low and bump later. If the API can't be reached, enter a rate by hand; the size math works offline.