---
title: Transaction Fees
description:
  Learn about Solana's transaction fees, including the base and priority fees,
  how each is applied, and best practices for managing compute units in your
  transactions.
---

Every Solana transaction requires a base fee (SOL) to compensate validators for
processing the transaction. An optional prioritization fee is also available to
increase the probability that the transaction is processed by the current leader
(validator).

## Key Points

- The **base fee** for a transaction is a minimum of 5000 lamports per signature
  on the transaction.
- The **prioritization fee** (optional) is an additional fee paid to the
  validator to increase the probability that the transaction is processed.
- The prioritization fee is calculated as: **(compute unit limit \* compute unit
  price)**.
- The **compute unit limit** is the maximum number of compute units that the
  transaction can consume.
- The **compute unit price** is the price per compute unit, in micro-lamports.
- 1,000,000 micro lamports = 1 lamport
- The transaction fee payer must be an account owned by the System Program.

## Base Transaction Fee

The base fee is the minimum cost to send a transaction. The cost is a minimum of
[5000 lamports](https://github.com/anza-xyz/agave/blob/v2.1.13/sdk/fee-calculator/src/lib.rs#L106)
per signature, with a target of
[10000 lamports](https://github.com/anza-xyz/agave/blob/v2.1.13/sdk/fee-calculator/src/lib.rs#L63)
per signature.

The base fee is automatically paid for by the transaction fee payer, which is
the first signer on the transaction. The fee payer must be an account owned by
the System Program.

- [50% Burned](https://github.com/anza-xyz/agave/blob/v2.1.13/sdk/fee-calculator/src/lib.rs#L70):
  Half of the base fee is burned.
- [50% Distribution](https://github.com/anza-xyz/agave/blob/e621336acad4f5d6e5b860eaa1b074b01c99253c/runtime/src/bank/fee_distribution.rs#L58-L62):
  Half is paid to the validator that processed the transaction.

## Prioritization Fee

The prioritization fee is an optional fee paid to the validator to increase the
probability that the transaction is processed.

- [SIMD-0096](https://github.com/solana-foundation/solana-improvement-documents/blob/main/proposals/0096-reward-collected-priority-fee-in-entirety.md):
  100% of the priority fee is paid directly to the validator processing the
  transaction.

### Compute Units and Limits

When a transaction is executed, it consumes computational resources measured in
compute units (CU). Each instruction deducts from the transaction’s compute unit
budget.

- Maximum Limit: A transaction can use up to
  [1.4 million compute units](https://github.com/anza-xyz/agave/blob/v2.1.13/compute-budget/src/compute_budget_limits.rs#L14).
- Default Limit: By default, each instruction is limited to
  [200,000 compute units](https://github.com/anza-xyz/agave/blob/v2.1.13/compute-budget/src/compute_budget_limits.rs#L10).
- Custom Limit: You can request a specific compute unit limit by including a
  `SetComputeUnitLimit` instruction in your transaction.

For additional details into compute unit usage:

- [ComputeBudget Type](https://github.com/anza-xyz/agave/blob/v2.1.13/compute-budget/src/compute_budget.rs#L22-L130)
- [Compute Unit Consumption Defaults](https://github.com/anza-xyz/agave/blob/v2.1.13/compute-budget/src/compute_budget.rs#L149-L197)

Refer to the
[How to Request Optimal Compute](/developers/guides/advanced/how-to-request-optimal-compute)
guide for more details on compute unit usage.

### Compute Unit Price

The compute unit price, denominated in micro lamports, is the optional price
paid per compute unit to calculate the prioritization fee.

<Callout>1,000,000 micro lamports = 1 lamport</Callout>

Use the following resources to get real-time recommendations on the current
compute unit price:

- [Priority Fee API](https://docs.helius.dev/solana-apis/priority-fee-api) by
  Helius
- [Global Priority Fee Tracker](https://triton.one/solana-prioritization-fees/)
  by Triton

Refer to the
[How to Use Priority Fees](/developers/guides/advanced/how-to-use-priority-fees)
guide for more details on priority fees.

### Calculate Prioritization Fee

The prioritization fee is calculated as:

**Prioritization Fee = Compute Unit Limit × Compute Unit Price**

Use the following instructions to set the compute unit limit and price on a
transaction:

- [`SetComputeUnitLimit`](https://github.com/anza-xyz/agave/blob/v2.1.13/sdk/src/compute_budget.rs#L42-L44)
  to set a specific unit limit.
- [`SetComputeUnitPrice`](https://github.com/anza-xyz/agave/blob/v2.1.13/sdk/src/compute_budget.rs#L48-L50)
  to define the price per compute unit.

<Callout>

If these instructions are not provided, the transaction automatically uses the
default compute unit limit with a compute unit price of 0 (no prioritization
fee).

The priority fee is based on the compute unit requested for the transaction, not
the actual compute units used by the transaction. If you set a compute unit
limit that is too high or use the default amount, you may be paying for unused
compute units.

</Callout>

### Examples

Below are examples of the instructions used to set the compute unit limit and
price for a transaction.

#### Rust

The `solana-sdk` provides methods through the
[`ComputeBudgetInstruction`](https://github.com/anza-xyz/agave/blob/v2.1.13/sdk/src/compute_budget.rs#L17-L31)
type:

```rust
let limit_instruction = ComputeBudgetInstruction::set_compute_unit_limit(300_000);

let price_instruction = ComputeBudgetInstruction::set_compute_unit_price(1);
```

#### JavaScript

The `@solana/web3.js` library (v1) provides methods through the
[`ComputeBudgetProgram`](https://solana-labs.github.io/solana-web3.js/v1.x/classes/ComputeBudgetProgram.html)
class:

```js
const limitInstruction = ComputeBudgetProgram.setComputeUnitLimit({
  units: 300_000,
});

const priceInstruction = ComputeBudgetProgram.setComputeUnitPrice({
  microLamports: 1,
});
```
