---
eip: 141
label: EIP-141
title: Designated invalid EVM instruction
status: Final
type: Standards Track
category: Core
created: 2017-02-09
official: https://eips.ethereum.org/EIPS/eip-141
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-141.md
canonical: https://eips.huatuo.xyz/eip-141/
lang: en
tldr: Reserves opcode 0xfe as the permanent INVALID instruction, giving compilers a deliberate way to abort execution that no future upgrade will ever reuse.
tags: [evm, opcode, core]
---

# EIP-141: Designated invalid EVM instruction

> An instruction is designated to remain as an invalid instruction.

**TL;DR:** Reserves opcode 0xfe as the permanent INVALID instruction, giving compilers a deliberate way to abort execution that no future upgrade will ever reuse.

## What problem does it solve?

Any byte that is not a defined opcode makes the EVM stop with an exceptional halt. Compilers took advantage of this: to crash on purpose, they emitted an unused byte. The catch is that "unused" could change. A later hard fork might give that byte a meaning, and old contracts that relied on it to abort would suddenly behave differently.

EIP-141 removes that risk. It picks one byte and promises that it will always stay invalid, so "abort here" has a stable, explicit encoding.

## How it works

The specification is one line: opcode **`0xfe` is the `INVALID` instruction**.

- Executing `0xfe` causes an exceptional halt, just like any other undefined opcode.
- As with every exceptional halt, the current call frame's state changes are rolled back and **all remaining gas in that frame is consumed**.
- The caller sees the call as failed, with no return data.
- No hard fork will ever assign `0xfe` a different meaning.

The spec notes that nobody had used this byte before, so the designation changed nothing for existing contracts. It simply turned an accident of the opcode table into a guarantee.

## Sample code

Raw bytecode that immediately aborts:

```text
0xfe        // INVALID: exceptional halt, all gas consumed
```

Emitting it from inline assembly in Solidity:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract Abort {
    function boom() external pure {
        assembly {
            invalid() // compiles to 0xfe
        }
    }
}
```

Compare this with `revert()`, which also undoes state changes but refunds unused gas and can return an error message:

```solidity
function softFail() external pure {
    revert("nope"); // REVERT (0xfd), unused gas is returned
}
```

## Things to know

- Before Solidity 0.8.0, a failed `assert` compiled to `0xfe`, so it burned all remaining gas. Since 0.8.0, `assert` uses `REVERT` with a `Panic(uint256)` error instead.
- [EIP-140](/eip-140/) `REVERT` is almost always the better choice for intentional failures. It refunds unused gas and can carry an error reason.
- The spec notes that `INVALID` can serve as an `ABORT` instruction. That is its whole purpose: it gives a halt a distinct, intentional cause.
- `INVALID` is treated like any other undefined byte. The difference is that `0xfe` is guaranteed to stay undefined.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-141
