> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# How to get Solana devnet SOL (including airdrops and faucets)

> The ways to get devnet and testnet SOL for Solana development: web faucets, RPC provider and Discord faucets, airdrops on a local validator, and reclaiming SOL from old buffers and programs.

This is a collection of the different ways for developers to acquire SOL on
Solana's testing networks, the Solana devnet and testnet.

The public devnet and testnet RPC endpoints no longer serve airdrops:
`solana airdrop` and the `requestAirdrop` RPC method return HTTP `410` there,
and the Solana CLI reports it as a rate limit. Use a web faucet for devnet and
testnet SOL, and airdrop only on a local validator.

## 1. Web Faucet

_Available for Devnet_

1. [faucet.solana.com](https://faucet.solana.com) - A public web faucet hosted
   by the Solana Foundation
2. [QuickNode](https://faucet.quicknode.com/solana/devnet) - A web faucet
   operated by QuickNode
3. [DevnetFaucet.org](https://devnetfaucet.org) - A web faucet with a rate limit
   separate than the public RPC endpoints, operated by
   [@Ferric](https://twitter.com/ferric)
4. [Blueshift Faucet](https://faucet.blueshift.gg) - A web faucet for Blueshift
   NFT holders
5. [Pine Stake Faucet](https://www.pinestake.com/faucet) - A public web faucet
   hosted by Pine Stake

_Available for Testnet_

1. [faucet.solana.com](https://faucet.solana.com) - A public web faucet hosted
   by the Solana Foundation
2. [QuickNode](https://faucet.quicknode.com/solana/testnet) - A web faucet
   operated by QuickNode
3. [TestnetFaucet.org](https://testnetfaucet.org) - A web faucet with a rate
   limit separate than the public RPC endpoints, operated by
   [@Ferric](https://twitter.com/ferric)
4. [Blueshift Faucet](https://faucet.blueshift.gg) - A web faucet for Blueshift
   NFT holders
5. [Pine Stake Faucet](https://www.pinestake.com/faucet) - A public web faucet
   hosted by Pine Stake

## 2. RPC Provider Faucets

_Available for Devnet_

RPC Providers can opt in to distributing devnet SOL via their devnet Validators.

> If you are an RPC Provider and want to distribute SOL please
> [get in touch here](https://c852ena8x5c.typeform.com/to/cUj1iRhS).

Currently supported:

1. [Helius](https://www.helius.dev/)
2. [QuickNode](https://faucet.quicknode.com/solana/devnet)
3. [Triton](https://triton.one/)

### Using the Solana CLI

Specify your [Cluster](/developers/docs/references/clusters) to be your RPC provider's URL:

```shell
solana config set --url <your RPC url>
```

Then request an airdrop from your provider's endpoint:

```shell
solana airdrop 2
```

### Using Web3.js

<Warning>
  **`@solana/web3.js` 1.x is no longer actively maintained**

  It receives critical fixes only. Use [Kit](/developers/docs/clients/official/javascript#solana-kit) for new code. To migrate existing code, follow the [Kit upgrade guide](https://www.solanakit.com/docs/upgrade-guide), or the [web3.js v3 migration guide](https://github.com/solana-foundation/solana-web3.js/blob/main/docs/web3js-v1-to-v3-migration.md) to keep the class-based API.

  To run this code, install 1.x with `npm install @solana/web3.js@1`. A plain `npm install @solana/web3.js` installs v3, which this code doesn't run on.
</Warning>

```js
// Replace with the RPC URL from your provider
const connection = new Connection("https://your-rpc-url.example.com");
const signature = await connection.requestAirdrop(publicKey, LAMPORTS_PER_SOL);
```

## 3. Discord Faucets

Various Discord communities have setup devnet SOL Faucets as BOTs.

| Community   | Usage                                      | Link                                         |
| ----------- | ------------------------------------------ | -------------------------------------------- |
| The 76 Devs | Run `!gibsol` in the BOT commands channel. | [Join Server](https://discord.gg/RrChGyDeRv) |

## 4. Airdrop on a local validator

_Available on a local validator_

A local validator, such as Surfpool (`surfpool start`) or
`solana-test-validator`, runs its own faucet and serves airdrops on its RPC
endpoint, `http://localhost:8899`. Here are two ways of requesting one:

### Using the Solana CLI:

```shell
solana airdrop 2 --url localhost
```

### Using web3.js:

<Warning>
  **`@solana/web3.js` 1.x is no longer actively maintained**

  It receives critical fixes only. Use [Kit](/developers/docs/clients/official/javascript#solana-kit) for new code. To migrate existing code, follow the [Kit upgrade guide](https://www.solanakit.com/docs/upgrade-guide), or the [web3.js v3 migration guide](https://github.com/solana-foundation/solana-web3.js/blob/main/docs/web3js-v1-to-v3-migration.md) to keep the class-based API.

  To run this code, install 1.x with `npm install @solana/web3.js@1`. A plain `npm install @solana/web3.js` installs v3, which this code doesn't run on.
</Warning>

```js
import { Connection, Keypair, LAMPORTS_PER_SOL } from "@solana/web3.js";

const connection = new Connection("http://localhost:8899", "confirmed");
const publicKey = Keypair.generate().publicKey; // or your wallet's public key
const signature = await connection.requestAirdrop(publicKey, LAMPORTS_PER_SOL);
```

See more:
[`requestAirdrop()`](https://solana-foundation.github.io/solana-web3.js/v1.x/classes/Connection.html#requestairdrop)
documentation inside web3.js, and
[Getting Test SOL](/developers/cookbook/development/test-sol) for the same call
in Kit, Rust, Python and Go.

## 5. Reuse devnet SOL

The most sustainable way to save SOL is to reuse it. With the Solana CLI you can
list all of your buffer accounts with the following command:

```shell
solana program show --buffers
```

and close all of them at once to reclaim their SOL:

```shell
solana program close --buffers
```

<Note>

**What's a buffer account?**

Buffer accounts are automatically created when you deploy a program. All the
program's data is transferred into this account during the deployment. When it's
done, the data of your program is replaced with the new data.

</Note>

Normally, these buffer accounts are closed automatically. In the event they are
not, you can also close a single buffer account to reclaim the SOL in it using
the following command:

```shell
solana program close <buffer account>
```

You can also use the `show` subcommand to list all programs you have already
deployed to your currently selected cluster:

```shell
solana program show --programs
```

You can then close each program with the `close` subcommand to retrieve the SOL
you used to deploy it. The CLI only closes a program when you pass
`--bypass-warning`, because a closed program id can't be used again:

```shell
solana program close <program id> --bypass-warning
```

You can then use that SOL to deploy new programs.

<Warning>

You will **NOT** be able to use the same program id again once you closed the
program. So make sure you are closing the right program and that you will not
need that id anymore.

If you get rate limited by the RPC endpoint your Solana CLI is configured to
use, you can add `-u "urlToYourRpc"` to any of these commands to use a
different RPC endpoint.

</Warning>
