CONSTANT_CASE Converter

Convert any phrase into CONSTANT_CASE (also called SCREAMING_SNAKE_CASE) — all uppercase letters joined by underscores. Standard for environment variables and constants.

Example: max retry attemptsMAX_RETRY_ATTEMPTS

CONSTANT_CASE (also widely known as SCREAMING_SNAKE_CASE or UPPER_SNAKE_CASE) is the convention where words are uppercase and joined by underscores. It's the universal style for environment variables, named constants, C/C++ macros, and (historically) enum members.

The visual loudness — all caps plus separators — signals to readers that the value is special: globally scoped, immutable, or compile-time. Most languages don't enforce the convention but every team picks it up because it makes constants distinguishable at a glance.

Use cases

Environment variables

DATABASE_URL, STRIPE_SECRET_KEY, NODE_ENV. POSIX env-var names are conventionally CONSTANT_CASE; many shells reject lowercase env-var names entirely.

Named constants

MAX_RETRIES = 3, DEFAULT_TIMEOUT_MS = 5000, PI = 3.14159. Per Python's PEP 8, JavaScript convention, and most C/C++ style guides, top-level constants are CONSTANT_CASE.

C and C++ macros

#define MAX_BUFFER 4096 — preprocessor macros are CONSTANT_CASE to make them visually distinct from regular identifiers (since they're substituted at compile time, not evaluated like normal code).

Configuration keys

Some configuration formats (especially older Unix tools and .env files) use CONSTANT_CASE keys: LOG_LEVEL=debug, HTTP_PORT=8080.

Legacy enum values

Older C++ and Java code uses CONSTANT_CASE for enum members (OrderStatus.PENDING); modern style guides prefer PascalCase for enum values.

Frequently asked questions

Is CONSTANT_CASE the same as SCREAMING_SNAKE_CASE?

Yes — they're synonyms. "CONSTANT_CASE" is preferred in formal style guides; "SCREAMING_SNAKE_CASE" is the more memorable name programmers actually use in conversation. Both refer to identical output.

When should I NOT use CONSTANT_CASE?

For values that look constant but are actually re-assignable (let x = 1 in JavaScript), use the language's variable convention instead. Reserve CONSTANT_CASE for values that are genuinely immutable: literal constants, env-var names, and compile-time macros.

Why are environment variables conventionally uppercase?

Historical: early Unix shells reserved lowercase names for shell-local variables and uppercase for exported (environment) variables. The convention stuck even after the technical distinction blurred.

Can I have lowercase environment variables?

POSIX shells allow them, but most tooling (Docker, Kubernetes, CI systems, twelve-factor app config) assumes uppercase. Stick with CONSTANT_CASE to avoid edge-case bugs.

Embed our tools on your website

Free for any site. No signup. Iframe loads from our servers and stays up-to-date automatically.

📋 Embed the Word Counter

Copy this snippet:

Live preview:

📋 Embed this CONSTANT_CASE Converter

Copy this snippet:

Live preview:

Want more options? All embeddable tools →