# selectFork

Description: selectFork cheatcode documentation

Note: This document was authored using MDX

  Source: https://github.com/NomicFoundation/hardhat-website/tree/main/src/content/docs/docs/reference/cheatcodes/Forking/select-fork.mdx

{/* This document contains content copied/adapted from the Foundry Book (MIT licensed). See LICENSE in the parent directory. */}

### Signature

```solidity
function selectFork(uint256 forkId) external;
```

### Description

Takes a fork identifier created by `createFork` and sets the corresponding forked state as active.

### Examples

Select a previously created fork:

```solidity
uint256 forkId = vm.createFork(MAINNET_RPC_URL);

vm.selectFork(forkId);

assertEq(vm.activeFork(), forkId);
```

### SEE ALSO

- [createFork](/docs/reference/cheatcodes/forking/create-fork)
- [activeFork](/docs/reference/cheatcodes/forking/active-fork)
