# Automation Billing and Costs
Source: https://docs.chain.link/chainlink-automation/overview/automation-economics

> For the complete documentation index, see [llms.txt](/llms.txt).

## Cost of using Chainlink Automation

Chainlink Automation requires only an execution fee for transactions onchain. This fee includes the transaction cost, a node operator percentage fee, and a small fixed gas overhead accounting for gas between the network and the registry.
The percentage fee compensates the Automation Network for monitoring and performing your upkeep. The Automation percentage fee varies by chain and is listed on our [Supported Networks](/chainlink-automation/overview/supported-networks) page.

The fee calculation for upkeeps that are configured for LINK payments (or other non-native payments as applicable) have a conversion from native tokens to LINK (or other non-native payments as applicable).
This conversion is not performed in the fee calculation for upkeeps that are configured for native token payments. Otherwise, the fee formula is the same for both payment types:

<TabsContent sharedStore="paymentMethod" client:visible>
  <Fragment slot="tab.1">LINK</Fragment>
  <Fragment slot="tab.2">Native tokens</Fragment>

  <Fragment slot="panel.1">
    **Formula for Registry v2.3**

    Fee<sub>LINK</sub> = \[tx.gasPrice<sub>Native WEI</sub> \* gasUsed \* (1 + premium%) + (gasOverhead \* tx.gasPrice<sub>Native WEI</sub>)]/\[LINK/Native<sub>Rate in WEI</sub>]
  </Fragment>

  <Fragment slot="panel.2">
    **Formula for Registry v2.3**

    Fee<sub>Native</sub> = tx.gasPrice<sub>Native WEI</sub> \* gasUsed \* (1 + premium%) + (gasOverhead \* tx.gasPrice<sub>Native WEI</sub>)
  </Fragment>
</TabsContent>

There is no registration fee or other fees for any offchain computation.

> **NOTE: Additional fees for specific cases**
>
> On Automation v2.3 and earlier, there is an additional flat per-transaction fee of 0.01 LINK in the following cases:

- For testnet transactions on all supported networks to account for node infrastructure costs.

### Fee calculation example

An upkeep transaction was [performed](https://polygonscan.com/tx/0x19309782e15952c90dcadcc02cbf34f331daaeee369d3e3acca43bade02af105) on *Polygon mainnet*. It used *110,051* gas at a gas price of *182,723,799,380 wei*.
The node operator percentage on Polygon was *70%* at the time of this transaction, and this fee [varies by network](/chainlink-automation/overview/supported-networks).

The tables below show how the fees are calculated for upkeeps configured for LINK payments:

The LINK/MATIC exchange rate for this transaction was *7,308,290,731,273,610,000 wei*. The upkeep's LINK balance was reduced by a fee of *0.008077 LINK*. The preceding information and calculation can be found in the table below:

| Variable                          | Description                                                                                                                       | Value                     |
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
| tx.gasPrice<sub>Native WEI</sub>  | Gas price of the transaction                                                                                                      | 182, 723, 799,380         |
| gasUsed                           | Gas used for performUpkeep calculated in solidity                                                                                 | 110,051                   |
| gasOverhead                       | Fixed gas amount used for transaction call from node to Registry                                                                  | 80,000                    |
| premium%                          | Current premium on Polygon which can be found on the [Supported Networks page](/chainlink-automation/overview/supported-networks) | 70%                       |
| LINK/Native<sub>Rate in WEI</sub> | Exchange rate fetched from Chainlink Oracle                                                                                       | 7,308,290,731,273,610,000 |

0.008077 = \[182,723,799,380 \* (110,051 + 80,000) \* (1 + 70%)]/\[7,308,290,731,273,610,000]

## How funding works

Upkeeps have a LINK (ERC-677) balance. Every time an onchain transaction is performed for your upkeep, its LINK balance will be reduced by the LINK fee.

Your upkeep's balance must exceed the [minimum balance](#minimum-balance). If this requirement is not met, the Automation Network will not perform onchain transactions. You can add funds using the [Chainlink Automation App](https://automation.chain.link/) or by directly calling the `addFunds()` function on the `AutomationRegistry` contract. Anyone can call the `addFunds()` function.

## Withdrawing funds

To withdraw a LINK balance, you must cancel your upkeep first. Any upkeep that has not spent more than an aggregated amount of 0.1 LINK fees over the span of its lifetime is subject to a *0.1 LINK* fee. This cancellation fee protects node operators from spammers who register jobs that never perform.

**Example 1**: Your upkeep has spent *4.8 LINK* over its lifetime and has a balance of *5 LINK*. When it is cancelled, I will receive *5 LINK*.
**Example 2**: Your upkeep has spent *0 LINK* over its lifetime and has a balance of *5 LINK*. When it is cancelled, I will receive *4.9 LINK*.

## No node competition

Individual Automation Nodes do not compete with one another, but rather work together to ensure all registered upkeeps are performed. This makes costs more predictable upfront, enabling you to estimate costs based on the expected gas consumption.

## Minimum balance

The Chainlink Automation Network is designed to perform your upkeep even when gas prices spike. The minimum balance in LINK reflects the best estimate of the cost to perform your upkeep when gas prices spike. To ensure your upkeep is monitored and performed, ensure that your upkeep's balance is above this minimum balance.

The minimum balance is calculated using the current fast gas price, the gas limit you entered for your upkeep, the max gas multiplier, and the LINK/Native<sub>Rate in WEI</sub> for conversion to LINK. To find the latest value for the `gasCeilingMultiplier`, see the [Registry Configuration](/chainlink-automation/overview/supported-networks) page.

Follow [maintain a minimum balance](/chainlink-automation/guides/manage-upkeeps/#maintain-a-minimum-balance) to ensure that your upkeep is funded.

## Price selection and gas bumping

Automation Nodes select the gas price dynamically based on the prices of transactions within the last several blocks. This optimizes the gas price based on current network conditions. Automation Nodes are configured to select a price based on a target percentile.

If the Automation Node does not see the `performUpkeep` transaction get confirmed within the next few blocks, it automatically replaces the transaction and bumps the gas price. This process repeats until the transaction is confirmed.

## ERC-677 LINK

For funding on mainnet, you will need ERC-677 LINK. Many token bridges give you ERC-20 LINK tokens. Use PegSwap to [convert Chainlink tokens (LINK) to be ERC-677 compatible](https://pegswap.chain.link/). Use [faucets.chain.link](https://faucets.chain.link/) to get testnet LINK.