> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usebruno.com/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/SoqoZDeDqkCirXSx/v2/images/screenshots/variables/no-environment.webp?fit=max&auto=format&n=SoqoZDeDqkCirXSx&q=85&s=e6aeedecd5b18fe468b048f2fb661d6f" 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/1O4OWJzDIk0uoLZ5/v2/images/screenshots/variables/collection-environment.webp?fit=max&auto=format&n=1O4OWJzDIk0uoLZ5&q=85&s=e02431e613e564bb5b8587559de1d118" 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/SoqoZDeDqkCirXSx/v2/images/screenshots/variables/environment-variables.webp?fit=max&auto=format&n=SoqoZDeDqkCirXSx&q=85&s=521d0af89f1e9574d8754815fd5652a4" 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>
