What Is a Gas Fee in Crypto and How Is It Calculated?
- Primary Signal: What Is a Gas Fee in Crypto and How Is It Calculated?
- Overview: A gas fee is the price you pay a blockchain to process your transaction: gas used times the base fee plus your tip. This guide works out the exact cost of a transfer, a swap and an...
- Verification: Analyzed and compiled by 1UpTrade Quant editorial monitoring desk.
A gas fee is the price you pay a blockchain to process your transaction. It is calculated as gas used multiplied by the sum of the base fee and your priority fee, and it is paid in the network's own coin. On Ethereum, a simple transfer uses 21,000 gas, so at a base fee of 10 gwei and a tip of 2 gwei it costs 252,000 gwei, or 0.000252 ETH.
Gas is the unit that measures the computational work a transaction needs. Every action on Ethereum costs a fixed amount of gas: a simple transfer of ETH costs 21,000 gas, a token swap costs roughly 100,000 to 150,000 gas, and minting an NFT can cost more than 200,000 gas. The more code your transaction runs, the more gas it uses.
Since the EIP-1559 upgrade in August 2021, the price of one unit of gas has two parts. The base fee is set automatically by the protocol for each block according to demand, and it is burned, which means it is removed from circulation rather than paid to anyone. The priority fee, also called a tip, is an extra amount you offer the validator to include your transaction quickly. One gwei equals 0.000000001 ETH.
Here is the full calculation for three common transactions at the same gas price of 12 gwei, with ETH at $3,000 (a stated example price, not a live quote). A simple transfer: 21,000 gas times 12 gwei equals 252,000 gwei, which is 0.000252 ETH, which is $0.76. A token swap at 120,000 gas: 120,000 times 12 equals 1,440,000 gwei, which is 0.00144 ETH, which is $4.32. An NFT mint at 200,000 gas: 200,000 times 12 equals 2,400,000 gwei, which is 0.0024 ETH, which is $7.20. The same 12 gwei price produces very different bills because the gas used is different.
When the network is busy, the base fee rises and every transaction gets more expensive. If the base fee climbs to 40 gwei and you tip 3 gwei, a simple transfer costs 21,000 times 43, which is 903,000 gwei, or 0.000903 ETH, or $2.71 at the same $3,000 ETH price. That is more than three times the quiet-network cost for the identical transfer.
Two facts catch beginners out. First, the fee does not shrink with the amount you move, so sending $5 of ETH with a $0.76 fee loses 15.1 percent of the amount to gas. Second, you pay gas even if your transaction fails, because the network still did the work. Your wallet also sets a maximum fee per unit and a gas limit, the most units the transaction may use, so a runaway contract cannot drain your wallet.
You can pay less without any special tools. Wait for quiet hours when the base fee is low, use a Layer 2 network where the same actions cost a fraction of mainnet gas, set a maximum fee you are willing to pay and let the wallet wait, and batch small transfers into one larger one instead of paying the fixed 21,000 gas cost many times. Bitcoin works differently: it has no gas, and its fees depend on the size of the transaction in bytes, priced in satoshis per virtual byte.
Q: How much is 1 gwei in ETH?
A: One gwei equals 0.000000001 ETH, which is one-billionth of an ETH.
Q: Do I pay gas if my transaction fails?
A: Yes. The network still did the computational work, so the gas is spent even though nothing was transferred.
Q: Why did my gas fee change after I sent the transaction?
A: The base fee is set fresh for every block according to demand, so it can move between the moment you send and the moment your transaction is included.
Q: Can gas fees be zero?
A: Not on Ethereum mainnet, because every transaction needs paid work. Layer 2 networks charge far less, but they still charge something.