Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Glossary

Max Fee Per Gas

Max Fee Per Gas is the maximum total amount a user is willing to pay per unit of gas, which includes the base fee and the priority fee.
Chainscore © 2026
definition
ETHEREUM TRANSACTION FEE MECHANISM

What is Max Fee Per Gas?

A critical parameter in Ethereum's EIP-1559 fee market that sets the absolute maximum a user is willing to pay for their transaction's computational execution.

Max Fee Per Gas is the ceiling price, denominated in gwei, that a transaction sender agrees to pay for each unit of gas consumed. It is a core component of the transaction fee, which is calculated as (Base Fee + Priority Fee) * Gas Used. The network will never charge more than this maxFeePerGas value. This parameter provides users with fee certainty, protecting them from unexpected spikes in the network's base fee during the time between transaction submission and inclusion in a block.

The actual fee paid is determined by the formula min(baseFee + priorityFee, maxFeePerGas). The base fee is burned by the protocol, while the priority fee (or "tip") is paid to the block proposer. If the sum of the current block's base fee and your set priority fee is lower than your maxFeePerGas, you pay the lower amount. However, if the base fee rises above your maxFeePerGas, your transaction will become "stuck" or fail, as it cannot be included without exceeding your specified maximum.

Setting this value requires estimating network congestion. Users and wallets often reference gas fee oracles or recent block history to set a maxFeePerGas that is high enough to ensure timely inclusion but not wastefully excessive. It directly interacts with the max priority fee per gas parameter. A transaction with a maxFeePerGas of 100 gwei and a maxPriorityFeePerGas of 2 gwei signals a willingness to pay up to 100 gwei total, with 2 gwei of that reserved as a tip, assuming the base fee is 98 gwei or less.

This mechanism, introduced by EIP-1559, created a more predictable fee market than the previous first-price auction model. It is distinct from the legacy gas price parameter, which was a single value encompassing both the base fee and tip. All Ethereum clients and wallets that support the London upgrade and subsequent hard forks use the maxFeePerGas and maxPriorityFeePerGas fields for transaction type 2 (EIP-1559 transactions).

For developers, correctly implementing maxFeePerGas is essential for user experience and transaction reliability. Tools like the eth_maxPriorityFeePerGas RPC call, or libraries such as Ethers.js and Web3.js, provide methods to estimate and set this parameter. Failure to set an adequate maxFeePerGas is a common reason for transactions to remain pending in the mempool during periods of volatile demand.

how-it-works
EIP-1559 FEE MECHANISM

How Max Fee Per Gas Works

An explanation of the Max Fee Per Gas parameter introduced by EIP-1559, which defines the absolute maximum a user is willing to pay for a transaction's gas.

Max Fee Per Gas is the maximum total amount of wei (the smallest denomination of Ether) a user is willing to pay per unit of gas for their transaction to be included in a block on the Ethereum network. This parameter, a core component of the EIP-1559 fee market, sets an absolute ceiling on the transaction's cost, ensuring users are never charged more than this limit, even during periods of extreme network congestion. It is distinct from and interacts with the Base Fee and Priority Fee (Tip).

When a user submits a transaction, they specify both a Max Fee Per Gas and a Max Priority Fee Per Gas. The network's protocol first deducts the dynamically calculated Base Fee, which is burned. The remaining portion, up to the Max Priority Fee, is paid to the validator as a tip. The key rule is: Max Fee ≥ (Base Fee + Max Priority Fee). If the sum of the Base Fee and the user's desired tip exceeds the Max Fee, the transaction will not be processed until network conditions change.

This mechanism provides crucial price certainty and user protection. By setting a Max Fee, a user defines their total cost exposure. During a gas war or a sudden spike in demand, the Base Fee may rise, but the user's maximum expenditure is capped. Any unused portion of the Max Fee (the difference between Max Fee and the sum of the actual Base Fee + tip) is refunded to the user, making it a "max spend" rather than a guaranteed payment.

Wallets and users must estimate this parameter carefully. Setting it too low risks the transaction being stuck or dropped from the mempool if network fees rise. Setting it excessively high is safe for inclusion but may result in overpaying; the refund mechanism ensures you only pay the required Base Fee + Miner Tip. Most wallets provide fee estimation tools that suggest a Max Fee based on current network conditions and desired confirmation speed.

The introduction of Max Fee Per Gas with EIP-1559 created a more predictable fee market compared to the previous first-price auction model. It decouples the user's willingness to pay for inclusion (Max Fee) from their direct bid to validators (Priority Fee). This structure, combined with the burning of the Base Fee, makes transaction fee estimation more reliable and contributes to the network's economic sustainability.

key-components
MAX FEE PER GAS

Key Components of the Fee

maxFeePerGas is a critical parameter in EIP-1559 transactions, defining the absolute maximum a user is willing to pay per unit of gas. It is composed of two sub-components.

01

Base Fee

The base fee is the mandatory, algorithmically determined minimum gas price for a block, which is burned (destroyed) upon transaction inclusion. It adjusts dynamically per block based on network congestion, acting as the protocol-determined portion of the fee.

  • Set by the protocol, not the user.
  • Continuously adjusts to target ~50% block fullness.
  • Permanently removed from circulation via burning.
02

Priority Fee (Tip)

The priority fee (or tip) is the amount a user offers to miners/validators on top of the base fee to incentivize them to prioritize their transaction. This is the only portion of the fee the block producer receives.

  • Formula: priorityFee = min(maxFeePerGas - baseFee, maxPriorityFeePerGas)
  • Direct incentive for block producers.
  • Set separately via the maxPriorityFeePerGas parameter.
03

Max Priority Fee Per Gas

maxPriorityFeePerGas is a user-specified parameter that caps the priority fee (tip). It represents the maximum amount the user is willing to pay above the base fee to incentivize inclusion.

  • Key User Control: Users set this to compete for block space.
  • Interaction with Max Fee: The actual tip paid is the smaller of (maxFeePerGas - baseFee) and maxPriorityFeePerGas.
  • Example: If maxFeePerGas is 50 gwei and baseFee is 10 gwei, the max possible tip is 40 gwei, but it's capped by maxPriorityFeePerGas.
04

Fee Refund Mechanism

A core feature of EIP-1559 is that users are refunded the difference between their maxFeePerGas and the sum of the baseFee plus the actual priorityFee used. This prevents overpayment when network conditions improve.

  • Refund Formula: refund = maxFeePerGas - (baseFee + priorityFee)
  • Paid in ETH back to the sender's address.
  • Example: With maxFeePerGas=100, baseFee=15, and a priorityFee of 2, the user pays 17 gwei and gets an 83 gwei refund.
05

Interaction in a Transaction

When a user submits an EIP-1559 transaction, the wallet constructs it using both fee parameters. The protocol then calculates the final cost.

Process Flow:

  1. User sets maxFeePerGas (total cap) and maxPriorityFeePerGas (tip cap).
  2. At execution, the network uses the current baseFee.
  3. The actual priorityFee is calculated as min(maxPriorityFeePerGas, maxFeePerGas - baseFee).
  4. Total Cost: (baseFee + priorityFee) * gasUsed.
  5. Any unused portion of maxFeePerGas is refunded.
06

Comparison to Legacy Gas Price

maxFeePerGas replaces the legacy gasPrice field, introducing predictability and efficiency.

Key Differences:

  • Legacy (gasPrice): A single, static price. Users often overpay during low congestion.
  • EIP-1559 (maxFeePerGas): A cap with a dynamic baseFee + optional priorityFee. Users benefit from automatic refunds.
  • Economic Effect: The legacy model sent the full fee to miners. EIP-1559 burns the baseFee, reducing ETH supply inflation.
user-workflow
EIP-1559 FEE MECHANICS

User Workflow: Setting the Max Fee

A guide to the user-side mechanics of setting the Max Fee Per Gas, the critical parameter for transaction pricing and inclusion in EIP-1559.

Setting the Max Fee Per Gas (maxFeePerGas) is the primary action a user takes to define the total amount they are willing to pay for their transaction's execution, denominated in gwei. This parameter, introduced by EIP-1559, acts as a hard cap on the total cost per unit of gas, encompassing both the Base Fee (which is burned) and the Priority Fee (or tip, which goes to the miner/validator). The transaction will never cost more than this maximum value per gas unit, providing users with predictable cost control.

The workflow involves the user's wallet or application calculating or suggesting a maxFeePerGas value, typically based on the current network state. This is often derived by estimating the next block's Base Fee and adding a competitive Priority Fee. For example, if the network suggests a Base Fee of 15 gwei and a Priority Fee of 2 gwei, a prudent maxFeePerGas might be set to 20 gwei to account for potential Base Fee volatility. Users can manually adjust this value to accelerate a transaction (by raising it) or to wait for a cheaper block (by lowering it, risking delay).

When a transaction is submitted, the protocol first validates that the maxFeePerGas is greater than or equal to the current block's Base Fee. The effective fee paid is calculated as min(maxFeePerGas, Base Fee + Priority Fee). The difference between the maxFeePerGas and the sum of the actual fees is refunded to the user. This design ensures users only pay the market rate while being protected from unexpected spikes, as they are never charged above their declared maximum.

A critical related parameter is the Max Priority Fee Per Gas (maxPriorityFeePerGas), which the user sets separately. This defines the maximum tip for the block producer. The actual Priority Fee paid is min(maxPriorityFeePerGas, maxFeePerGas - Base Fee). Therefore, if the Base Fee rises to meet the maxFeePerGas, the tip can be reduced to zero, a scenario known as a zero-tip transaction. Understanding the interaction between these two max parameters is key to efficient fee management.

In practice, most users rely on their wallet's fee estimation algorithms, which query historical data and pending transaction pools to recommend optimal maxFeePerGas and maxPriorityFeePerGas values. Advanced users and bots may programmatically set these fees based on real-time mempool analysis, balancing speed against cost. This user-controlled workflow fundamentally shifts fee estimation from a blind auction (as with gasPrice) to a more transparent and efficient system with built-in safeguards.

EIP-1559 GAS FIELDS

Fee Parameter Comparison

A comparison of the three primary gas fee parameters used in Ethereum's EIP-1559 transaction model.

ParametermaxFeePerGasmaxPriorityFeePerGasgasPrice (Legacy)

Primary Purpose

Absolute maximum total fee per gas unit user will pay

Tip to the validator (miner), excluding base fee

Single, pre-EIP-1559 fee per gas unit

Fee Composition

baseFee + maxPriorityFeePerGas

Validator tip only

Bundled fee (no base/tip separation)

Burn Mechanism

Base fee portion is burned

Not burned (goes to validator)

Not burned (all goes to miner)

Price Predictability

High (caps total cost)

Medium (subject to market for tips)

Low (subject to full auction volatility)

Transaction Inclusion

Prioritized by effective tip (min(maxFee-basFee, maxPriorityFee))

Directly influences inclusion priority

Prioritized by full gasPrice amount

Required for EIP-1559

Required for Legacy

Typical Unit

Gwei

Gwei

Gwei

ecosystem-usage
MAX FEE PER GAS

Ecosystem Usage and Impact

Max Fee Per Gas is the maximum price a user is willing to pay per unit of gas for a transaction to be included in a block, directly influencing transaction speed, cost, and network congestion.

01

Priority Fee (Tip) vs. Max Fee

The Max Fee Per Gas is the absolute ceiling a user will pay. The actual fee deducted is the sum of the Base Fee (burned) and the Priority Fee (tip to the validator), but never exceeds the Max Fee. Any excess (Max Fee - (Base Fee + Priority Fee)) is refunded to the sender. This two-part structure separates the protocol's required burn from the validator's incentive.

02

Transaction Inclusion & Speed

Validators prioritize transactions with higher Max Fee Per Gas values, as they signal a higher potential tip. Setting a Max Fee too low relative to network demand can cause a transaction to be stuck pending or dropped. Wallets often use fee estimation APIs (e.g., from Etherscan, Blocknative) to suggest appropriate Max Fee values based on current mempool conditions.

03

EIP-1559 and Fee Market Reform

Max Fee Per Gas was introduced with EIP-1559 to improve user experience over the previous first-price auction model. Key changes include:

  • A variable Base Fee that is burned, making ETH deflationary.
  • A predictable fee market where users pay for inclusion (Base Fee) and priority (Tip) separately.
  • Larger block size variability to smooth transaction throughput.
04

Wallet UX and Estimation

Wallets abstract the complexity of setting Max Fee Per Gas. They typically offer speed tiers (e.g., Slow, Standard, Fast) that automatically calculate and set:

  • A Max Fee high enough to cover potential Base Fee increases.
  • A Priority Fee competitive for the desired confirmation speed. Advanced users can manually override these estimates, especially during periods of high volatility or for time-sensitive transactions like arbitrage.
05

Impact on dApp Design

dApp developers must account for variable gas costs. Common patterns include:

  • Gas estimation calls (eth_estimateGas) to predict costs before sending.
  • Implementing gas station networks (GSN) or meta-transactions for user onboarding.
  • Designing gas-efficient smart contracts to minimize the computational units (gas) required, as this multiplies the cost set by the Max Fee Per Gas.
06

Layer 2 and Fee Abstraction

On Layer 2 rollups (Optimistic, ZK), the Max Fee Per Gas concept often applies to the L1 settlement layer, but fees are drastically lower for users. L2s batch thousands of transactions, splitting the L1 cost. Users typically pay a single, simplified fee to the L2 sequencer, which abstracts away the direct Max Fee setting, though advanced users can still influence priority.

security-considerations
MAX FEE PER GAS

Security and Economic Considerations

The max fee per gas is a critical parameter in Ethereum's fee market (EIP-1559) that defines the maximum price a user is willing to pay for their transaction to be executed, balancing urgency with cost control.

01

Core Definition & Purpose

Max fee per gas is the absolute maximum amount of wei (1 gwei = 10^9 wei) a user authorizes to be deducted per unit of gas for a transaction. It acts as a hard cap to prevent unexpected high costs if network demand surges after the transaction is submitted. The actual fee paid is often lower, determined by the base fee and the priority fee.

02

Relationship to Base Fee & Priority Fee

Under EIP-1559, the total fee has two components burned and paid to validators:

  • Base Fee: The network-determined, burned fee per gas. It's variable and mandatory.
  • Priority Fee (Tip): An extra incentive paid to the validator. The max fee must cover both: Max Fee >= Base Fee + Priority Fee. If the base fee rises above the max fee, the transaction will stall until congestion eases.
03

Economic Security: Avoiding Stuck Transactions

Setting the max fee per gas too low is a primary cause of stuck transactions. If the network's base fee exceeds the user's max fee, the transaction will remain in the mempool indefinitely, unable to be included in a block. Wallets often estimate this dynamically, but users must understand this risk during periods of high volatility or network events like NFT mints.

05

Security Consideration: Frontrunning & MEV

A low max fee can make a transaction vulnerable to frontrunning. Bots monitor the mempool for profitable opportunities (e.g., arbitrage, liquidations) and can outbid a low-fee transaction by submitting their own with a higher max priority fee, causing the original transaction to fail or be delayed. This is a facet of Maximal Extractable Value (MEV).

06

Interaction with Gas Limit

Max fee per gas and gas limit together define the maximum total cost: Max Cost = Gas Limit * Max Fee Per Gas. A transaction will fail if the gas used exceeds the limit, but all gas up to the limit is charged at the agreed rate. Therefore, both parameters must be set correctly to control spending and ensure execution.

MAX FEE PER GAS

Common Misconceptions

Clarifying frequent misunderstandings about the maxFeePerGas parameter in Ethereum's EIP-1559 fee market, which is critical for transaction execution and cost estimation.

No, maxFeePerGas is the absolute maximum price per unit of gas you are willing to pay, not the guaranteed final price. The actual fee paid is the base fee plus the priority fee (tip), but it will never exceed your set maxFeePerGas. If the network's base fee is lower than your max, you pay less, and the unused portion is refunded. This mechanism protects users from overpaying during sudden base fee spikes.

Example: If you set maxFeePerGas: 150 gwei and the block's baseFee is 100 gwei with a maxPriorityFeePerGas of 2 gwei, you pay 102 gwei and get a refund of 48 gwei per gas unit.

MAX FEE PER GAS

Frequently Asked Questions

Essential questions and answers about the Max Fee Per Gas parameter, a critical component for controlling transaction costs on Ethereum and other EIP-1559 networks.

Max Fee Per Gas is the absolute maximum amount of wei (1 ETH = 10^18 wei) a user is willing to pay per unit of gas for their transaction to be included in a block on an EIP-1559 network. It acts as a hard spending cap, ensuring the total cost (Base Fee + Priority Fee) never exceeds this limit. The formula is: Max Fee Per Gas >= Base Fee + Priority Fee. Any unused portion of the Max Fee beyond the sum of the current Base Fee and your Priority Fee is refunded to your wallet.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team