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.
max retry attempts → MAX_RETRY_ATTEMPTS
Convert any phrase into CONSTANT_CASE (also called SCREAMING_SNAKE_CASE) — all uppercase letters joined by underscores. Standard for environment variables and constants.
max retry attempts → MAX_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.
DATABASE_URL, STRIPE_SECRET_KEY, NODE_ENV. POSIX env-var names are conventionally CONSTANT_CASE; many shells reject lowercase env-var names entirely.
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.
#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).
Some configuration formats (especially older Unix tools and .env files) use CONSTANT_CASE keys: LOG_LEVEL=debug, HTTP_PORT=8080.
Older C++ and Java code uses CONSTANT_CASE for enum members (OrderStatus.PENDING); modern style guides prefer PascalCase for enum values.
The tool converts input text to CONSTANT_CASE by first splitting on any non-alphanumeric delimiter (whitespace, hyphens, dots, underscores, etc.) into words. Each word is then converted to uppercase using the Unicode uppercase mapping (covers ASCII and accented Latin). Finally, the words are joined with a single underscore _. The algorithm preserves digits but strips leading/trailing delimiters. For example, 'v2.0-beta' becomes V2_0_BETA. Consecutive delimiters are collapsed into one underscore. The transformation is locale-independent, treating all letters via the standard toUpperCase JavaScript method.
While CONSTANT_CASE is straightforward, developers often use command-line or programming tools for the same effect.
| This tool | sed command | Python one-liner | |
|---|---|---|---|
| UI simplicity | Web-based, no install needed | Requires terminal, basic Unix | Requires Python installation |
| Real-time preview | Yes, instant conversion | No, must re-run after edit | No, manual execution each time |
| Handling of complex input | Splits on all non-alphanumeric | Relies on regex, can be tuned | Flexible with regex but needs coding |
| Batch processing | Single string only | Can process files line by line | Can process files with script |
CONSTANT_CASE, often called UPPER_SNAKE_CASE or SCREAMING_SNAKE_CASE, emerged with early programming languages like C, where preprocessor macros (e.g., #define MAX_SIZE 100) were conventionally written in all caps with underscores. The Unix shell also adopted this style for environment variables (e.g., PATH, HOME). The term 'SCREAMING_SNAKE_CASE' was later popularized in the Ruby and Python communities to describe this visually loud naming convention.
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.
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.
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.
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.