There is a OP_EQUAL opcode that returns (from the Bitcoin wiki):

1 if the inputs are exactly equal, 0 otherwise

And a OP_NUMEQUAL opcode that returns:

1 if the numbers are equal, 0 otherwise

In the case where you want to use OP_NOTEQUAL it is suggested to use OP_NUMNOTEQUAL so it seems like OP_EQUAL and OP_NUMEQUAL can be used interchangeably when dealing with integers:


What is the point of the OP_NUMEQUAL opcode? Can't you just always use OP_EQUAL instead? Is OP_NUMEQUAL more efficient than OP_EQUAL when dealing with integers?

1 Answer 1


OP_NUMEQUAL doesn't provide a subset of the functionality of OP_EQUAL as they evaluate differently when comparing 0x01 with 0x0001. OP_NUMEQUAL evaluates 0x01 and 0x0001 as equal as it compares 1 with 1 whilst OP_EQUAL does not deem them equal as it compares a different number of bytes. Hence which one you use in your script will be determined by whether you want such a comparison to evaluate to equal or not.

Edit (August 2023):

Note the Taproot descriptor multi_a uses the OP_NUMEQUAL opcode. multi_a(k,A,B,C,...Z) translates to:


There is no strong reason for it doing so as multi_a will always have the number encoded minimally. It arguably makes it easier to parse as OP_EQUAL is used in multiple other Miniscript constructions.

Thanks to individuals on IRC for clarifying the latter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.