Solidity Bytecode Size Analyzer

Check compiled contract bytecode against the 24 KB size limit and estimate the minimum deployment gas.

Check the 24 KB contract size limit

Ethereum rejects contracts whose deployed code is larger than 24,576 bytes, a rule introduced by EIP-170, and since EIP-3860 it also rejects creation code over 49,152 bytes. Paste the compiled bytecode from Hardhat, Foundry, Remix or solc and this tool tells you how close you are, how many bytes you have to spare, and a floor estimate for the gas needed to deploy it.

Runtime versus creation bytecode

  • Runtime (deployed) bytecode is what stays on the chain. It is the one the 24 KB limit applies to. In Hardhat it is the deployedBytecode field, and in Foundry it is the deployedBytecode in the artifact.
  • Creation (init) bytecode is runtime code plus the constructor and is what the deployment transaction carries. It is checked against the 49,152 byte initcode limit.

How the gas estimate works

A deployment pays 21,000 base gas, 32,000 for contract creation, and calldata gas of 4 per zero byte and 16 per non-zero byte. Contracts then pay 200 gas for every byte of runtime code stored, and EIP-3860 adds 2 gas per 32-byte word of initcode. The estimate cannot include what your constructor does when it runs, such as writing storage or calling other contracts, so treat it as the minimum and measure the real cost on a test network.

Ways to shrink a large contract

Enable the optimizer with a low runs value, use custom errors in place of revert strings, remove unused code, move shared logic into libraries, and split big systems across several contracts. Other chains and test networks can have different limits, and some allow larger contracts, so check the one you deploy to. Foundry and Hardhat can also print contract sizes during a build.

Frequently asked questions

Which bytecode should I paste?

Paste the runtime bytecode to check the 24 KB limit. Paste the creation bytecode to check the initcode limit.

Where do I find the bytecode?

In Hardhat or Foundry build artifacts (bytecode and deployedBytecode fields), in Remix under Compilation Details, or from solc with the --bin and --bin-runtime options.

Is the gas figure exact?

No. It is a floor that leaves out the constructor's execution and any storage writes, so the real deployment cost is higher.

Does this limit apply on every chain?

Ethereum mainnet enforces it. Many EVM chains copy it, but some change or remove it, so check your target chain.

Is my bytecode uploaded?

No. The analysis runs in your browser.

More in Web3 & Crypto SEO Tools