---
title: "Use, Access & Share Environment Variables on Netlify"
description: "Learn how you can use environment variables in Netlify’s build process plus access and share them super, duper easily!"
source: "https://www.netlify.com/blog/2021/12/09/use-access-and-share-environment-variables-on-netlify/"
last_updated: "2026-07-15T21:59:45.000Z"
---
> Throughout December we’ll be [highlighting a different Netlify feature each day](https://www.netlify.com/blog/2021/12/01/highlighting-a-different-netlify-feature-each-day-in-december/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=env-vars). It might just be the thing you need to unlock those creative juices, and [dust off that domain](https://www.netlify.com/blog/2021/12/01/dusty-domains-your-forgotten-domains-raise-money-for-charity/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=env-vars) you registered but never deployed! Keep an eye [on the blog](https://www.netlify.com/blog/2021/12/01/highlighting-a-different-netlify-feature-each-day-in-december/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=env-vars) and on [Twitter](https://twitter.com/netlify) for each feature!

Netlify allows you to create and access build environment variables in a secure, and private location in your project’s dashboard. `Site settings > Build & deploy > Environment > Environment variables`, to be exact, ooh or `Team settings > Sites > Global site settings > Shared environment variables` if you’re the “sharing is caring” type.

![](/v3/img/blog/screen-shot-2021-12-09-at-3.25.49-am.jpg)

These can also be set using the [Netlify configuration file, `netlify.toml`](https://docs.netlify.com/configure-builds/file-based-configuration/). On top of that, you can even inject those environment variables into any shell command (such as the `[build]` command and `ignore` command). [Here’s more info on that](https://docs.netlify.com/configure-builds/file-based-configuration/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=env-vars#inject-environment-variable-values) and here’s what that would look like.

netlify.toml

```
[build]  command = "cp ./ ${PROJECT_COPY_DIR} && npm run build"  publish = "dist/my-project"  environment = {    PROJECT_COPY_DIR = "/that/one/place",    GO_IMPORT_PATH = "go/go/gadget.go",    API_KEY = "abc1234teeheehee"  }
[context.staging] # “staging” is a branch name  command = "npm run dev"  base = "staging"  environment = { SOME_KEY = "t0te5Important5tuff" }
```

You can set different environment variables for different deploy contexts and access them through your serverless functions, snippet injection, app code (I tend to grab them via `process.env.THIS_ENV_VAR_NAME` in my code), and many other ways. If you have team members you are onboarding don’t worry about giving them the project env vars insecurely over slack or through multiple steps of auth, they just live with the project.

You can learn a bunch more [through our docs](https://docs.netlify.com/configure-builds/environment-variables/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=env-vars). There is all kinds of fun stuff there including a bunch of environment variables that tell you things like build metadata, git metdata, build hook meta data (& payload), deploy URLS and MORE metadata!

Hope this helps you keep things available to your nice devs and away from naughty hackers. Happy coding 👩🏻‍💻!

### Share

-   [X (fka Twitter)](https://twitter.com/intent/tweet?text=Use, Access & Share Environment Variables on Netlify&url=https://www.netlify.com/blog/2021/12/09/use-access-and-share-environment-variables-on-netlify//)
-   [LinkedIn](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.netlify.com%2Fblog%2F2021%2F12%2F09%2Fuse-access-and-share-environment-variables-on-netlify%2F%2F)
-   [Facebook](https://www.facebook.com/sharer.php?u=https://www.netlify.com/blog/2021/12/09/use-access-and-share-environment-variables-on-netlify//)
-   [Bluesky](https://bsky.app/intent/compose?text=Use, Access & Share Environment Variables on Netlify+https://www.netlify.com/blog/2021/12/09/use-access-and-share-environment-variables-on-netlify//)

* * *

### Tags

-   [Tips](/blog/tags/tips/)

## Keep reading

![](/images/blog-fallback-thumbnail.svg)

Guides & Tutorials December 10, 2020

[

### Environment variables in Next.js and Netlify

](/blog/2020/12/10/environment-variables-in-next.js-and-netlify/)

-   ![Profile picture of Cassidy Williams](/_astro/a62099fab0f946e063c4b84ff4b4d9c94f9aa7a5-400x400_ZdakPa.webp)
    
    Cassidy Williams
    

![](/images/blog-fallback-thumbnail.svg)

Guides & Tutorials May 21, 2020

[

### Localize your environment variables by context with build plugins

](/blog/2020/05/21/localize-your-environment-variables-by-context-with-build-plugins/)

-   ![Profile picture of Divya Tagtachian](/_astro/b9b198e6e1c100a667f1b9b97d1b39327587073f-80x80_Z2ehpic.webp)
    
    Divya Tagtachian
    

## Recent posts

News & Announcements July 14, 2026

[

### More headroom, a lower per-credit rate, and a bill you can predict: introducing new Pro plan tiers

](/blog/new-pro-plan-tiers)

-   ![Profile picture of Gehrig Kunz](/_astro/b4e9f58d914d1334ea70d53ea55a1f26b26f1445-512x512_17SwOI.webp)
    
    Gehrig Kunz
    

News & Announcements July 13, 2026

[

### Netlify inside of Claude Design

](/blog/netlify-inside-of-claude-design)

-   ![Profile picture of Sean Roberts](/_astro/bbf2243f8171dbddd80ab2103622106cef84d125-512x512_Z1d2LKE.webp)
    
    Sean Roberts
    

News & Announcements June 25, 2026

[

### Netlify Functions, designed for Agent Experience

](/blog/netlify-functions-designed-for-agent-experience)

-   ![Profile picture of Eduardo Bouças](/_astro/52958f21e8450baf6d8e60302341a984e220c0cd-512x512_13VDlu.webp)
    
    Eduardo Bouças
    

![](/_astro/3f255b372fa958df35802666ee33b4609b2d71bd-1200x1586_1VtE2D.webp)

### How do the best dev and marketing teams work together?

[Access the report](https://www.netlify.com/reports/2024-leadership-trend-report/access/)