Skip to content

Bitcoin accepted at checkout  |  Ships from Laval, QC, Canada  |  Expert support since 2016

Bitcoin Script Opcodes — Complete Reference

Every opcode in the Bitcoin Script language — the stack-based language that defines how bitcoins can be spent — with its hex byte, decimal value, category, status and function.

Quick answer

Bitcoin Script is a small, intentionally non-Turing-complete stack language: a locking script (scriptPubKey) sets spending conditions and an unlocking script (scriptSig / witness) satisfies them. This reference lists all 113 opcodes — word, hex byte, decimal, category, status and function. 15 are disabled (removed in 2010 for safety), several slots are reserved, and the upgradeable no-ops (OP_NOP1–NOP10) are how soft forks like CLTV and CSV added new rules without breaking old nodes.

Most everyday scripts use a handful of opcodes — OP_DUP, OP_HASH160, OP_EQUALVERIFY and OP_CHECKSIG build P2PKH; OP_CHECKMULTISIG, OP_CHECKLOCKTIMEVERIFY and OP_CHECKSEQUENCEVERIFY enable multisig and time-locks; Tapscript adds OP_CHECKSIGADD.

Download CSV Download JSON REST API →

WordHexDecCategoryStatusBIPFunction
OP_0 / OP_FALSE0x000ConstantsEnabledPush an empty byte array (numeric/boolean zero) onto the stack.
OP_PUSHBYTES_1–750x01–0x4b1ConstantsEnabledThe next opcode byte (1–75) is the number of subsequent bytes to push as data.
OP_PUSHDATA10x4c76ConstantsEnabledThe next 1 byte is the length; push that many following bytes.
OP_PUSHDATA20x4d77ConstantsEnabledThe next 2 bytes (LE) are the length; push that many following bytes.
OP_PUSHDATA40x4e78ConstantsEnabledThe next 4 bytes (LE) are the length; push that many following bytes.
OP_1NEGATE0x4f79ConstantsEnabledPush the number -1 onto the stack.
OP_RESERVED0x5080ReservedReservedInvalidates the script if executed (does nothing inside an unexecuted branch).
OP_1 / OP_TRUE0x5181ConstantsEnabledPush the number 1 onto the stack.
OP_20x5282ConstantsEnabledPush the number 2 onto the stack.
OP_30x5383ConstantsEnabledPush the number 3 onto the stack.
OP_40x5484ConstantsEnabledPush the number 4 onto the stack.
OP_50x5585ConstantsEnabledPush the number 5 onto the stack.
OP_60x5686ConstantsEnabledPush the number 6 onto the stack.
OP_70x5787ConstantsEnabledPush the number 7 onto the stack.
OP_80x5888ConstantsEnabledPush the number 8 onto the stack.
OP_90x5989ConstantsEnabledPush the number 9 onto the stack.
OP_100x5a90ConstantsEnabledPush the number 10 onto the stack.
OP_110x5b91ConstantsEnabledPush the number 11 onto the stack.
OP_120x5c92ConstantsEnabledPush the number 12 onto the stack.
OP_130x5d93ConstantsEnabledPush the number 13 onto the stack.
OP_140x5e94ConstantsEnabledPush the number 14 onto the stack.
OP_150x5f95ConstantsEnabledPush the number 15 onto the stack.
OP_160x6096ConstantsEnabledPush the number 16 onto the stack.
OP_NOP0x6197Flow controlEnabledDoes nothing.
OP_VER0x6298ReservedReservedInvalidates the script if executed.
OP_IF0x6399Flow controlEnabledExecute the following statements if the top stack value is true.
OP_NOTIF0x64100Flow controlEnabledExecute the following statements if the top stack value is false.
OP_VERIF0x65101ReservedReservedInvalidates the script even when inside an unexecuted branch.
OP_VERNOTIF0x66102ReservedReservedInvalidates the script even when inside an unexecuted branch.
OP_ELSE0x67103Flow controlEnabledSwitch execution within an OP_IF / OP_NOTIF … OP_ENDIF block.
OP_ENDIF0x68104Flow controlEnabledClose an OP_IF / OP_NOTIF / OP_ELSE block.
OP_VERIFY0x69105Flow controlEnabledMark the script invalid unless the top stack value is true; otherwise pop it.
OP_RETURN0x6a106Flow controlEnabledMark the output provably unspendable; commonly used to embed up to 80 bytes of data.
OP_TOALTSTACK0x6b107StackEnabledMove the top item to the alt stack.
OP_FROMALTSTACK0x6c108StackEnabledMove the top alt-stack item back to the main stack.
OP_2DROP0x6d109StackEnabledRemove the top two stack items.
OP_2DUP0x6e110StackEnabledDuplicate the top two stack items.
OP_3DUP0x6f111StackEnabledDuplicate the top three stack items.
OP_2OVER0x70112StackEnabledCopy the pair of items two spaces back to the top.
OP_2ROT0x71113StackEnabledMove the fifth and sixth items to the top.
OP_2SWAP0x72114StackEnabledSwap the top two pairs of items.
OP_IFDUP0x73115StackEnabledDuplicate the top item only if it is non-zero.
OP_DEPTH0x74116StackEnabledPush the current number of stack items.
OP_DROP0x75117StackEnabledRemove the top stack item.
OP_DUP0x76118StackEnabledDuplicate the top stack item (core of P2PKH).
OP_NIP0x77119StackEnabledRemove the second-from-top item.
OP_OVER0x78120StackEnabledCopy the second-from-top item to the top.
OP_PICK0x79121StackEnabledCopy the n-th item (n from the top) to the top.
OP_ROLL0x7a122StackEnabledMove the n-th item (n from the top) to the top.
OP_ROT0x7b123StackEnabledRotate the top three items.
OP_SWAP0x7c124StackEnabledSwap the top two items.
OP_TUCK0x7d125StackEnabledCopy the top item and insert it below the second item.
OP_CAT0x7e126SpliceDisabledConcatenate two byte strings. Disabled for security in 2010.
OP_SUBSTR0x7f127SpliceDisabledReturn a substring. Disabled.
OP_LEFT0x80128SpliceDisabledReturn the left substring. Disabled.
OP_RIGHT0x81129SpliceDisabledReturn the right substring. Disabled.
OP_SIZE0x82130SpliceEnabledPush the byte length of the top item (without popping it).
OP_INVERT0x83131Bitwise logicDisabledBitwise NOT. Disabled.
OP_AND0x84132Bitwise logicDisabledBitwise AND. Disabled.
OP_OR0x85133Bitwise logicDisabledBitwise OR. Disabled.
OP_XOR0x86134Bitwise logicDisabledBitwise XOR. Disabled.
OP_EQUAL0x87135Bitwise logicEnabledPush 1 if the top two items are byte-equal, else 0 (core of P2SH).
OP_EQUALVERIFY0x88136Bitwise logicEnabledOP_EQUAL then OP_VERIFY — fail unless the top two items are equal.
OP_RESERVED10x89137ReservedReservedInvalidates the script if executed.
OP_RESERVED20x8a138ReservedReservedInvalidates the script if executed.
OP_1ADD0x8b139ArithmeticEnabledAdd 1 to the top number.
OP_1SUB0x8c140ArithmeticEnabledSubtract 1 from the top number.
OP_2MUL0x8d141ArithmeticDisabledMultiply the top number by 2. Disabled.
OP_2DIV0x8e142ArithmeticDisabledDivide the top number by 2. Disabled.
OP_NEGATE0x8f143ArithmeticEnabledFlip the sign of the top number.
OP_ABS0x90144ArithmeticEnabledAbsolute value of the top number.
OP_NOT0x91145ArithmeticEnabledPush 1 if the top number is 0, else 0.
OP_0NOTEQUAL0x92146ArithmeticEnabledPush 0 if the top number is 0, else 1.
OP_ADD0x93147ArithmeticEnabledAdd the top two numbers.
OP_SUB0x94148ArithmeticEnabledSubtract the top number from the second.
OP_MUL0x95149ArithmeticDisabledMultiply the top two numbers. Disabled.
OP_DIV0x96150ArithmeticDisabledDivide. Disabled.
OP_MOD0x97151ArithmeticDisabledModulo. Disabled.
OP_LSHIFT0x98152ArithmeticDisabledLeft bit-shift. Disabled.
OP_RSHIFT0x99153ArithmeticDisabledRight bit-shift. Disabled.
OP_BOOLAND0x9a154ArithmeticEnabledPush 1 if both numbers are non-zero, else 0.
OP_BOOLOR0x9b155ArithmeticEnabledPush 1 if either number is non-zero, else 0.
OP_NUMEQUAL0x9c156ArithmeticEnabledPush 1 if the two numbers are equal, else 0.
OP_NUMEQUALVERIFY0x9d157ArithmeticEnabledOP_NUMEQUAL then OP_VERIFY.
OP_NUMNOTEQUAL0x9e158ArithmeticEnabledPush 1 if the two numbers are not equal, else 0.
OP_LESSTHAN0x9f159ArithmeticEnabledPush 1 if the second number is less than the top.
OP_GREATERTHAN0xa0160ArithmeticEnabledPush 1 if the second number is greater than the top.
OP_LESSTHANOREQUAL0xa1161ArithmeticEnabledPush 1 if the second number is ≤ the top.
OP_GREATERTHANOREQUAL0xa2162ArithmeticEnabledPush 1 if the second number is ≥ the top.
OP_MIN0xa3163ArithmeticEnabledPush the smaller of the top two numbers.
OP_MAX0xa4164ArithmeticEnabledPush the larger of the top two numbers.
OP_WITHIN0xa5165ArithmeticEnabledPush 1 if x is within [min, max).
OP_RIPEMD1600xa6166CryptographyEnabledHash the top item with RIPEMD-160.
OP_SHA10xa7167CryptographyEnabledHash the top item with SHA-1.
OP_SHA2560xa8168CryptographyEnabledHash the top item with SHA-256.
OP_HASH1600xa9169CryptographyEnabledSHA-256 then RIPEMD-160 (address hashing).
OP_HASH2560xaa170CryptographyEnabledDouble SHA-256 of the top item.
OP_CODESEPARATOR0xab171CryptographyEnabledMark the point from which signature checks cover the script.
OP_CHECKSIG0xac172CryptographyEnabledVerify a signature against a public key over the transaction.
OP_CHECKSIGVERIFY0xad173CryptographyEnabledOP_CHECKSIG then OP_VERIFY.
OP_CHECKMULTISIG0xae174CryptographyEnabledVerify m-of-n signatures (consumes one extra item — the off-by-one bug).
OP_CHECKMULTISIGVERIFY0xaf175CryptographyEnabledOP_CHECKMULTISIG then OP_VERIFY.
OP_NOP10xb0176Reserved (NOP)ReservedUpgradeable no-op reserved for a future soft fork.
OP_CHECKLOCKTIMEVERIFY (OP_NOP2)0xb1177LocktimeEnabledBIP65Fail unless the output is spent at or after an absolute time/height (CLTV).
OP_CHECKSEQUENCEVERIFY (OP_NOP3)0xb2178LocktimeEnabledBIP112Fail unless a relative lock-time has elapsed (CSV).
OP_NOP40xb3179Reserved (NOP)ReservedUpgradeable no-op reserved for a future soft fork.
OP_NOP50xb4180Reserved (NOP)ReservedUpgradeable no-op reserved for a future soft fork.
OP_NOP60xb5181Reserved (NOP)ReservedUpgradeable no-op reserved for a future soft fork.
OP_NOP70xb6182Reserved (NOP)ReservedUpgradeable no-op reserved for a future soft fork.
OP_NOP80xb7183Reserved (NOP)ReservedUpgradeable no-op reserved for a future soft fork.
OP_NOP90xb8184Reserved (NOP)ReservedUpgradeable no-op reserved for a future soft fork.
OP_NOP100xb9185Reserved (NOP)ReservedUpgradeable no-op reserved for a future soft fork.
OP_CHECKSIGADD0xba186CryptographyTapscriptBIP342Tapscript-only: verify a signature and add 1 to an accumulator (batch multisig).

Source: Bitcoin Core script/script.h (opcodetype enum) and the Bitcoin Wiki Script reference. Related: soft-fork registry, BIP index, transaction sizes, address types. See the open data hub.