---
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-11-14T18:25:19.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)
-   [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_1J61Ub.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_1eTvTQ.webp)
    
    Divya Tagtachian
    

## Recent posts

News & Announcements November 10, 2026

[

### Netlify goes full stack: introducing Netlify Server

](/blog/introducing-netlify-server/)

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

News & Announcements September 29, 2026

[

### 5x faster Edge Functions: v8 isolates to Unikraft MicroVMs

](/blog/edge-functions-firecracker-microvms/)

-   Jake Champion
    
-   ![Profile picture of Aarthy Chandrasekhar](/images/people/aarthy-chandrasekhar.jpg)
    
    Aarthy Chandrasekhar
    
-   ![Profile picture of Ivan Zarea](/_astro/451968a8e873f95cf69c7edd78eb29a9035541eb-1024x1024_2wyTXf.webp)
    
    Ivan Zarea
    

Opinions & Insights September 22, 2026

[

### How we built Git storage for millions of Netlify projects

](/blog/how-we-built-git-storage-for-millions/)

-   ![Profile picture of Philippe Serhal](/_astro/795792fe4d14648b1b96285e46426ed964b802d7-512x512_Z23ebKb.webp)
    
    Philippe Serhal
    

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

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

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