Skip to content
DonateБГ

Bitcoin Script

OP_RETURN

OP_RETURN outputs carry data in a bitcoin transaction, and nobody can spend them. Learn the hex, the zero-value rule and the size limit by Core version.

By Dimitar Zurnov · Updated 4 Nov 2026
Adapted from Learn Me a Bitcoin by Greg Walker.

OP_RETURN is a locking script that can never be unlocked. It starts with the OP_RETURN opcode, which ends the script at once and marks it invalid. Data pushes follow it. Because the output can never be spent, its only job is to carry data. Anyone can create one, and nodes do not need to keep it in the UTXO set, since no later transaction can use it.

Putting data on chain is debated. OP_RETURN was added to stop data from sitting in outputs that look spendable, and that is still its main purpose.

What does an OP_RETURN output look like?

An OP_RETURN output: zero amount, a 13-byte script, OP_RETURN, then the data hello world. An OP_RETURN output, by field amount: 0 satoshis, 8 bytes 0000000000000000 script length: 13 bytes 0d OP_RETURN: ends the script 6a push 11 bytes 0b the data: hello world 68656c6c6f20776f726c64 Nobody can spend it, so the value is lost.
An output has an amount and a script. This one carries the text hello world.

The output's locking script is 13 bytes:

6a0b68656c6c6f20776f726c64

6a is OP_RETURN, and 0b pushes the next 11 bytes. Those bytes spell hello world. Output 2 of 6dfb16dd580698242bcfd8e433d557ed8c642272a368894de27292a8844a4e75 uses this script.

The data can be any bytes. Text is common, but nothing requires it.

What are the rules for an OP_RETURN output?

  • The script can contain only OP_RETURN followed by data pushes. The opcodes OP_1 to OP_16 count as pushes too.
  • Use a value of 0 satoshis. Nodes accept any value, but satoshis on an OP_RETURN output are lost for good, since nobody can spend the output.

Can you spend an OP_RETURN output?

No. The lock can never open, so an OP_RETURN output has no unlocking script. It can never be used as an input in a later transaction.

How much data can an OP_RETURN output hold?

The limit depends on the version of Bitcoin Core that a node runs, and it has changed several times.

How the OP_RETURN data limit grew: 40 bytes in 0.9, 80 in 0.11, 83 bytes total in 0.12, and a 100,000 byte default in 30.0. Data limits by Core version v0.9.0 2014 one push, up to 40 bytes one OP_RETURN output allowed v0.11.0 2015 one push, up to 80 bytes one OP_RETURN output allowed v0.12.0 2016 several pushes, 83 bytes the whole script, pushes included v30.0 2025 default 100,000 bytes all OP_RETURN outputs share it A policy setting: each node sets its own limit.
Each row is a release. The limits are node policy, so they are not part of consensus.
  • v0.9.0 (March 2014): one data push of up to 40 bytes, and one OP_RETURN output per transaction. The 0.9.0 release notes describe it.
  • v0.11.0 (2015): one data push of up to 80 bytes.
  • v0.12.0 (2016): several data pushes, with the whole script limited to 83 bytes.
  • v30.0 (October 2025): the default -datacarriersize rose to 100,000 bytes. That effectively removes the cap, because the standard transaction size limit is reached first. The limit applies to all OP_RETURN outputs in a transaction together, and several OP_RETURN outputs are now permitted. Setting -datacarriersize=83 restores the older limit. The 30.0 release notes give the details.

These are policy settings. Each node decides what it relays, so a transaction above one node's limit may still reach a miner who accepts it.

How do you push more than 75 bytes?

A one-byte push opcode, OP_PUSHBYTES_X, can carry at most 75 bytes. For 76 to 255 bytes, use OP_PUSHDATA1 (4c), which is followed by a one-byte length. For 80 bytes, the start of the script is 6a 4c 50, where 50 is 80 in hex, followed by the 80 bytes of data. OP_PUSHDATA2 (4d) takes a two-byte length, in little-endian order, for 256 to 65,535 bytes.

Which OP_RETURN outputs can you check on our explorer?

To find OP_RETURN outputs in a transaction, look for a script that starts with 6a. Most of them have a value of 0 satoshis.

Why does OP_RETURN exist?

Before version 0.9.0, people stored data inside outputs that looked spendable. A text string could sit where a public key hash goes in a P2PKH lock. That worked, but a node could not tell that the output was unspendable. It would keep the output in the UTXO set forever, which uses up memory.

OP_RETURN fixes this. The output is provably unspendable, so nodes can leave it out of the UTXO set. The change does not endorse storing data on chain. It keeps the data out of the outputs that nodes must track.

Does an OP_RETURN always make a script fail?

No. The script fails only when OP_RETURN runs. The redeem script OP_IF OP_1 OP_ELSE OP_RETURN OP_ENDIF has an OP_RETURN in its OP_ELSE branch, which never runs when the spend pushes OP_1. The script is valid, and it leaves one OP_1 behind. Input 0 of 890d3814c2bc2516ff8e061d7a4580116459f4f693f2783d11a5fbb4b3597ac2 shows this inside a P2SH lock.

For the other script types, see the script overview.

In this section: Bitcoin Script

All of Bitcoin from zero

Something look wrong? Tell us