How to Read Layer 2 Gas Fees: Execution Fee vs Data Fee

 / 
2

When you make a transaction on Arbitrum, the gas fee shown in your wallet is actually two fees stacked together: the execution fee belongs to L2, and the data fee belongs to L1. They are calculated separately.

OKX Exchange
A leading global cryptocurrency platform,suitable for both beginners and experienced traders.
New user benefit: 20% off trading fees upon registration!!

What you'll learn

Understand how Layer 2 (L2) gas fees are structured: what the execution fee and data fee are, how they are calculated, and why the same transfer can cost very differently at different times.

Key concepts

A Layer 2 transaction fee is made up of two parts:

  1. L2 execution fee (Execution Gas Fee)

    • This is the computing resource used when the transaction actually runs on the L2 network.

    • The logic is the same as Ethereum mainnet: gas used × gas price. A transaction on L2 uses the same amount of gas as on Ethereum mainnet. For example, an ETH transfer uses 21,000 gas on mainnet and also uses 21,000 gas on L2.

    • The only difference is that L2 gas prices are much cheaper than mainnet, so this part is much lower.

  2. L1 data fee (L1 Data Fee)

    • L2 is cheap because it packs many transactions together and submits them to Ethereum mainnet. But the packed transaction data still has to be posted to mainnet. That cost is called the L1 data fee.

    • This fee is set by Ethereum mainnet's base fee (or blob base fee), not by the L2 itself. The more congested mainnet is, the higher the L2 data fee.

    • It is calculated based on the size of the compressed transaction data. The more complex the transaction (such as swaps or contract calls), the larger the data, and the higher the data fee.

Total fee = L2 execution fee + L1 data fee.

Comparison

Fee typeSet byWhat affects itHow it changes
L2 execution feeThe L2 network itselfTransaction complexity (gas used), L2 congestionRelatively stable, adjusted by the L2's EIP-1559 mechanism
L1 data feeEthereum mainnetCompressed transaction data size, mainnet base fee / blob base feeChanges with mainnet fees (can change up to 12.5% per block)

Arbitrum has a special detail: its gas fee is shown as one fee on the user side, but underneath it converts the L1 data fee into L2 gas units and includes it in the gas limit. So when you call eth_estimateGas, the returned value already includes a gas buffer for the L1 data fee.

Common confusion

"Why is my gas fee still much higher than usual when the L2 network is not congested?"

Because Ethereum mainnet suddenly became congested. The L2 data fee follows mainnet's base fee. When mainnet fees rise, L2 gas fees rise too. If L2 feels "not congested", that means the L2 execution fee did not rise, but the L1 data fee did.

"Why do some L2 transfers have very low gas fees while others are very high?"

Different L2s have different compression efficiency and use different methods to post data. Chains that use EIP-4844 blob submission are much cheaper than those that use calldata. Also, the more complex the transaction (such as multiple contract calls), the larger the data and the higher the data fee.

How to do it

Case A: Using a wallet

  • The gas fee estimate shown by the wallet already includes execution fee + data fee. You do not need to split them yourself.

  • But if the gas fee looks unusually high, you can wait for mainnet gas fees to come down before transacting, because the L2 data fee follows mainnet.

Case B: Estimating with code

  • Call eth_estimateGas to get the gas limit, then multiply it by the L2 gas price to get the total fee.

  • If you need to separate the L1 data fee, call the getL1Fee method on the GasPriceOracle contract (for OP Stack chains).

What to check after

After the transaction is confirmed, check the transaction details in a block explorer:

  • Look at the L1 Data Fee field for the exact amount (some explorers show it separately).

  • Find Gas Used and Gas Price. Multiply them to get the execution fee.

  • Adding the two gives the actual gas fee you paid.

OKX Exchange
A leading global cryptocurrency platform,suitable for both beginners and experienced traders.
New user benefit: 20% off trading fees upon registration!!

FAQ

Q: Do Arbitrum and Optimism calculate data fees in exactly the same way?

A: The underlying logic is the same: both compress transaction data and post it to Ethereum. But the exact parameters (compression algorithm and scalar parameters) are slightly different. On OP Stack chains, baseFeeScalar and blobFeeScalar have different values.

Q: Why did my transaction still take a long time even after I set a high priority fee on Arbitrum?

A: Arbitrum's sequencer does not order transactions by priority fee. It processes them first come, first served. On Arbitrum, setting a priority fee does not affect speed. On Optimism, the priority fee affects the sequencer's processing order.