All Tools

Bitcoin Transaction Decoder

Parse raw transaction hex or lookup by txid

Decoding happens in your browser. Transaction data is never sent to our servers.

What is a Raw Bitcoin Transaction?

A raw Bitcoin transaction is a serialized, hexadecimal representation of a Bitcoin transaction. It contains all the information needed to transfer bitcoin from one address to another, including inputs (where the funds come from), outputs (where they go), and cryptographic signatures proving ownership.

Raw transactions are broadcast to the Bitcoin network where miners include them in blocks. Before broadcasting, you can decode the raw hex to verify amounts, destinations, and fees.

Bitcoin Transaction Structure

Every Bitcoin transaction consists of these core components:

  • Version - A 4-byte integer indicating the transaction format version (usually 1 or 2)
  • Inputs - References to previous transaction outputs being spent, plus signatures
  • Outputs - Destinations for the funds with amounts and locking scripts
  • Locktime - Optional time constraint before the transaction can be mined

SegWit Transactions

Segregated Witness (SegWit) transactions separate signature data from the main transaction structure. They're identified by a marker byte (0x00) and flag byte (0x01) after the version.

SegWit introduced the concept of "virtual bytes" (vbytes) and "weight units" for more efficient fee calculation. Witness data is discounted at 1/4 the cost of regular transaction data, making SegWit transactions cheaper to confirm.

Output Script Types

P2PKH (Pay to Public Key Hash)

The original Bitcoin output type. Funds are locked to a hash of a public key and require a signature from the corresponding private key to spend. Addresses start with "1".

P2SH (Pay to Script Hash)

Allows complex spending conditions hidden behind a hash. Used for multisig wallets and wrapped SegWit. Addresses start with "3".

P2WPKH (Pay to Witness Public Key Hash)

Native SegWit single-signature output. More efficient than P2PKH with lower fees. Addresses start with "bc1q".

P2WSH (Pay to Witness Script Hash)

Native SegWit script hash for complex conditions like multisig. Addresses start with "bc1q" followed by a longer string.

P2TR (Pay to Taproot)

The newest output type from the Taproot upgrade. Offers improved privacy and efficiency for complex scripts. Addresses start with "bc1p".

OP_RETURN

A provably unspendable output used to embed arbitrary data in the blockchain. Limited to 80 bytes and commonly used for timestamping and metadata.

Frequently Asked Questions

What is a raw Bitcoin transaction?

A raw Bitcoin transaction is the serialized binary data of a transaction, typically displayed as a hexadecimal string. It contains all transaction details including inputs, outputs, amounts, and signatures. This tool decodes that hex string into human-readable components.

How do I read a Bitcoin transaction?

Bitcoin transactions have a specific binary format. They start with a 4-byte version, followed by inputs (previous transactions being spent), outputs (destinations), and a 4-byte locktime. This decoder parses all these fields and shows them in a readable format.

What is the difference between size and virtual size?

Size is the actual byte length of the serialized transaction. Virtual size (vsize) accounts for SegWit's discount on witness data. For legacy transactions, they're equal. For SegWit transactions, vsize is smaller, resulting in lower fees.

What is transaction weight?

Weight is a metric introduced with SegWit. It equals base size (non-witness data) times 3, plus total size. Virtual size is weight divided by 4. Block space is limited to 4 million weight units.

How is the transaction fee calculated?

The fee equals total input value minus total output value. Since inputs reference previous outputs (not included in the raw transaction), you typically need to look up those previous transactions to know the exact input values and calculate the fee.

What does the sequence number mean?

The sequence number is a 4-byte field in each input. 0xffffffff means the input is "final" and locktime is ignored. 0xfffffffe signals RBF (Replace-By-Fee) is enabled. Lower values can enable relative time locks.

What is locktime?

Locktime prevents a transaction from being mined until a specific time. Values below 500 million are interpreted as block heights. Higher values are Unix timestamps. A locktime of 0 means the transaction can be mined immediately.

What is witness data in SegWit transactions?

Witness data contains the signatures and public keys needed to authorize spending. In SegWit transactions, this data is "segregated" from the main transaction structure, which provides benefits like fixing transaction malleability and enabling fee discounts.

Instant Bitcoin Transactions

Spark processes Bitcoin transactions instantly. Build faster payment experiences with our Bitcoin L2.