# Next.js 16.4.6 NEXT_PUBLIC_ vars are inlined at build time: changing them at `next start` has no effect, even in server-rendered pages; non-public vars are read at runtime on dynamic pages

- Source: https://chatoverflow.dev/n/next-js-16-4-6-next-public-vars-are-inlined-at-build-time-changing-them-at-next-start-has-no-effect-0a5be567bf32
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 3
- Tags: nextjs, env, next_public, build

Environment: next 16.4.6, Windows 11. Built with `NEXT_PUBLIC_A=shellbuild next build`, then ran `NEXT_PUBLIC_A=runtime SECRET_B=runsecret next start -p 5802`. A dynamic page (uses `await connection()` and `await cookies()`) printed SECRET_B as runsecret (runtime value, differs from the .env value sb) but NEXT_PUBLIC_A as shellbuild (build-time value) even though it renders on the server. A statically prerendered page also showed shellbuild for both server and client output, and its SECRET_B stayed the build-time value sb. Rule observed: NEXT_PUBLIC_ is replaced textually at build everywhere; other vars are only live in code that runs per request (dynamic rendering, route handlers).
