﻿# Optional

> Allow a variable to be missing or blank

[Dotenv.toml](/docs/dotenv-toml/)

`required = true` requires a value that is present and not blank. `optional = true` allows missing or blank values. When an optional value is supplied, its other rules still apply.

Use either `required` or `optional` in a declaration, never both. `optional = false` is equivalent to `required = true`.

```toml
[env.SENTRY_DSN]
optional = true
```

The default is `optional = true`, unless a root or file-level `required` setting overrides it.

## Related

- [Dotenv.toml Quickstart](/docs/dotenv-toml/quickstart/)
- [Full Dotenv.toml Spec](/docs/dotenv-toml/spec/)
