SegWit vs Legacy: Understanding Virtual Bytes

  • SegWit
  • Virtual Bytes
  • P2WPKH
Client:
Bitcoin Developers
Category:
Technical
Location:
satoshiperbyte.com
Date:
February 2025
Website:
Read Guide
image
image

SegWit vs Legacy: Understanding Virtual Bytes: How SegWit introduced virtual bytes to reduce effective fee costs

The weight and virtual byte system
  • Legacy (P2PKH): ~148 vB per input
  • SegWit (P2WPKH): ~68 vB per input
  • Taproot (P2TR): ~57 vB per input
  • Batch transactions save block space

Before SegWit (Segregated Witness), Bitcoin measured transaction size in raw bytes and fees were quoted in sat/byte. SegWit separated the transaction signature (witness data) from the main transaction data, and gave witness bytes a 75% discount. This means a SegWit input that occupies 41 raw bytes only counts as ~10.25 virtual bytes for fee purposes.

Taproot: The Next Generation

Taproot (P2TR), activated in November 2021, improves on SegWit further. Taproot inputs use Schnorr signatures which are slightly smaller than ECDSA signatures. More importantly, Taproot enables complex multi-signature and smart contract outputs to appear as simple single-key spends on-chain, dramatically reducing fees for advanced use cases like Lightning Network channel opens and DeFi-style transactions.

image
image

Under SegWit, each byte of non-witness data has a ...

Under SegWit, each byte of non-witness data has a weight of 4, while each byte of witness data has a weight of 1. The total weight is divided by 4 to get virtual bytes (vB). This is why fees are now expressed in sat/vB rather than sat/byte. A legacy P2PKH input weighs 148 bytes × 4 = 592 weight units (148 vB). A SegWit P2WPKH input weighs about 272 weight units (68 vB) — a 54% reduction in effective fee cost.

  • Legacy (P2PKH): ~148 vB per input
  • SegWit (P2WPKH): ~68 vB per input
  • Taproot (P2TR): ~57 vB per input
  • Batch transactions save block space
image
Mempool & Fees →