> ## Documentation Index
> Fetch the complete documentation index at: https://bruno-a6972042-mintlify-71caebff.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment Variables

Environment variables are variables that are scoped to an environment, such as local development or production. They are useful for storing variables that can be re-used across the collection that are different depending on the environment. An example would be the host url of the server you want to test.

## Creating an Environment Variable

* Go to environments (top right) and press **No environment**.

<img src="https://mintcdn.com/bruno-a6972042-mintlify-71caebff/9jc2Za9fgmoXrJwK/v2/images/screenshots/variables/no-environment.webp?fit=max&auto=format&n=9jc2Za9fgmoXrJwK&q=85&s=60544819c0f5885c015d9e50988275e5" alt="No-Environment" width="2684" height="1410" data-path="v2/images/screenshots/variables/no-environment.webp" />

* If there are no environments, you will be prompted to create one.

<img src="https://mintcdn.com/bruno-a6972042-mintlify-71caebff/9jc2Za9fgmoXrJwK/v2/images/screenshots/variables/collection-environment.webp?fit=max&auto=format&n=9jc2Za9fgmoXrJwK&q=85&s=bc489cc35d71a7615a6edcebfcc0a472" alt="No-Environment" width="2684" height="1410" data-path="v2/images/screenshots/variables/collection-environment.webp" />

* Add your variable name and value for the specific environment.
* Save your changes.

<img src="https://mintcdn.com/bruno-a6972042-mintlify-71caebff/9jc2Za9fgmoXrJwK/v2/images/screenshots/variables/environment-variables.webp?fit=max&auto=format&n=9jc2Za9fgmoXrJwK&q=85&s=3dcbd8ee675a785f17a47b046ae809e7" alt="Environment Variables location" width="2760" height="1070" data-path="v2/images/screenshots/variables/environment-variables.webp" />

## Using an Environment Variable

Just like other variables you can use the `{{varName}}` syntax to use an environment variable in a request. On the top-right, you can see which environment you are currently using and select a different one.

## Using the ./environment directory

Environment variables are synced with the `/environments` directory inside your collection. You can also create and manage environments there.

Each environment is saved in a `<environment-name>.bru` file, which looks like this:

```bash local.bru theme={null}
vars {
  host: http://localhost:8787
}
```

<Info>
  For information on importing and exporting environment variables, see the [Import/Export Environments](/get-started/import-export-data/import-export-environments) guide.
</Info>
