Size
Bitcoin transaction size is counted in bytes, weight units and virtual bytes. Learn how the weight formula and the 4,000,000 weight unit limit work.
By Dimitar Zurnov · Updated 4 Nov 2026
Adapted from Learn Me a Bitcoin by Greg Walker.
A transaction's size can be counted in three units. Bytes are the real size of the data, in storage and on the network. Weight units decide how many transactions fit in a block. Virtual bytes, which are weight units divided by four, let you compare fee rates. The example transaction 30dcd74b… is 226 bytes, 574 weight units and 143.5 virtual bytes.
How many bytes is a transaction?
A byte is eight bits, and in hexadecimal it takes two characters. So a transaction's byte count is half the length of its raw hex. Here is the raw form of the example transaction:
01000000000101dd40a8d7f105055e781afa632207f5d3c4b4f4cad9f0fb320d0f0aa8e1ba904b0000000000ffffffff021027000000000000160014858e1f88ff6f383f45a75088e15a095f20fc663f841c0000000000001976a9142241a6c3d4cc3367efaa88b58d24748caef79a7288ac02483045022100d66341c3e6ce846b92bedcf9bc673ab8e47b770c616618eb91009e44816f4c2f0220622b5ebf6afabee3f4255bbcb84609e1185d4b6b1055602f5eed2541e26324620121022ed6c7d33a59cc16d37ad9ba54230696bd5424b8931c2a68ce76b0dbbc222f6500000000
It is 452 characters, which is 226 bytes. The count grows with each input and output, and the size of every unlocking and locking script adds to it. Bytes matter when data is sent across the network or stored in the block files.
Typical sizes for legacy transactions
The table below shows typical sizes for transactions that spend and create standard P2PKH outputs. Each input is 147 or 148 bytes, depending on whether its signature is 71 or 72 bytes, and each output is 34 bytes. Every transaction carries 10 bytes of fixed overhead.
| Inputs | Outputs | Size in bytes |
|---|---|---|
| 1 | 1 | 191 or 192 |
| 1 | 2 | 225 or 226 |
| 2 | 1 | 338 to 340 |
| 2 | 2 | 372 to 374 |
Each extra input or output adds to the size. A transaction can, in principle, grow as large as a block. Nodes relay only transactions up to 400,000 weight units by default, which is 100,000 virtual bytes, so most wallets stay far below that. SegWit transactions follow a different pattern, because part of their data is counted differently.
How are weight units calculated?
Weight is the measure used for the block limit. Each part of a transaction is multiplied by 4 or by 1, and the results are added. This was introduced by SegWit in BIP 141. Non-witness data counts four times. The witness, the marker and the flag count once.
The example transaction has 116 non-witness bytes and 110 witness bytes, which include the marker and flag. Its weight is:
116 × 4 + 110 × 1 = 574 weight units
Without the discount, the same 226 bytes would weigh 904 units. The witness saves 330 units, which is the whole point of the rule.
Written as code, the calculation is short. Here total is the full size in bytes and base is the size without the marker, the flag and the witness:
def weight(total: int, base: int) -> int:
witness = total - base # the marker, flag and witness data
return base * 4 + witness
print(weight(226, 116)) # 574
What is the block limit?
A block can hold up to 4,000,000 weight units. Before SegWit, the limit was 1,000,000 bytes, and every byte counted the same. The new limit is a weight rule. A block with SegWit transactions can therefore be bigger in bytes than the old limit, as long as its weight stays within the cap.
Miners therefore fill their blocks by weight. The consensus rule is in Bitcoin Core's constants, where MAX_BLOCK_WEIGHT is 4,000,000.
The weight rule also makes the fair price of an output and an input closer. Creating an output needs a lock, which is small. Spending it needs a signature, which is large. Counting witness data at a discount pulls those costs closer together.
What are virtual bytes?
The virtual size, in virtual bytes (vB), is the weight divided by four:
virtual size = weight ÷ 4
574 ÷ 4 = 143.5 vB
Weight is always a whole number, because the consensus code uses integers. Virtual bytes can be fractions, which is why the example is 143.5. Virtual bytes put SegWit and legacy transactions on the same scale. A legacy transaction has no witness, so its virtual size equals its byte size.
Fee rates use virtual bytes. A transaction of 200 vB paying 10 sat/vB pays 2,000 sats. The fee page shows how this works with real transactions.
Why does a node report a whole number?
Bitcoin Core rounds the virtual size up to a whole number when it measures a transaction. For the example, that is 144 vB, not 143.5. The rounding is in Bitcoin Core's policy code, where the formula is (weight + 3) / 4 with integer division. Your own calculation may differ by a fraction for that reason.
How do you check a transaction's size?
A node reports all three measures for any transaction it knows. Run bitcoin-cli getrawtransaction <txid> 1 and look for these fields:
size: the size in bytes.vsize: the virtual size, rounded up as described above.weight: the weight in weight units.
Most explorers show the same figures on each transaction's page. The virtual byte and fee rate pages explain the terms.
Summary
Bytes measure the data, weight units measure the block space, and virtual bytes measure the cost for fee purposes. The witness costs one unit per byte instead of four, so SegWit transactions stay small in weight. The block limit is 4,000,000 weight units, which is 1,000,000 virtual bytes. Wallets use these sizes to set fees before they sign, as the PSBT page explains for the signing process.
Sources
- BIP 141: transaction size calculations gives the weight rule and the multipliers.
- Bitcoin Core consensus constants sets the block weight limit.
- Bitcoin Core policy code rounds the virtual size.
- Bitcoin Core policy constants sets the default weight limit for relayed transactions.
In this section: Transactions
Something look wrong? Tell us