Skip to main content

Try it Live

Run BaseFeePerGas examples in the interactive playground

BaseFeePerGas

EIP-1559 base fee per gas representing the minimum gas price required for transaction inclusion. The base fee is dynamically adjusted each block based on network congestion and is burned (removed from circulation).

Overview

Branded bigint type representing base fee in Wei. Adjusts ±12.5% per block targeting 50% block fullness (15M gas target, 30M max).

Quick Start

Type Definition

Branded bigint preventing misuse with other fee types. All values in Wei.

API

Construction

from(value)

Create from bigint, number, or hex string.

fromGwei(gwei)

Create from Gwei value.

fromWei(wei)

Create from Wei value (alias for from).

Conversion

toGwei(baseFee)

Convert to Gwei.

toWei(baseFee)

Convert to Wei (identity).

toNumber(baseFee)

Convert to number. Warning: precision loss on large values.

toBigInt(baseFee)

Convert to bigint (identity).

Comparison

equals(baseFee1, baseFee2)

Check equality.

compare(baseFee1, baseFee2)

Compare values. Returns -1, 0, or 1.

EIP-1559 Base Fee Mechanics

Dynamic Adjustment

Base fee adjusts each block targeting 50% capacity:
  • Target gas: 15M per block
  • Max gas: 30M per block
  • Adjustment: ±12.5% max per block

Calculation Formula

Clamped to max ±12.5% change per block.

Fee Burning

Base fee is burned (removed from supply):

Real-world Examples

Parse Block Header

Typical Fee Ranges (2024)

Fee Monitoring

Specification