Cancel a stuck transaction on the blockchain in MetaMask

Sometimes you will find yourself with a stuck transaction. So what to do now?

You can cancel this transaction, by sending yourself a 0-value transaction with the same nonce.

Before you can do this, you need to go to MetaMask Settings > Advanced and enable Customize transaction nonce.

Screenshot 2022-05-05 at 20.38.51

Find your nonce from the pending transaction in Etherscan.

Then go to MetaMask and send yourself a zero ETH transaction. Since you have enabled customize transaction nonce, go ahead and edit the nonce field to the pending nonce you just looked up.

When sending your cancel transaction, make sure gwei is higher then the pending transaction. You can check the current needed amount of gwei on this Gas Estimator.