What Is CONSTANT_CASE (SCREAMING_SNAKE_CASE)?
CONSTANT_CASE is an identifier format where every letter is capitalized and word boundaries are joined with underscores (_), such as MAX_RETRY_COUNT.
CONSTANT_CASE (often called SCREAMING_SNAKE_CASE or UPPER_SNAKE_CASE) is a programmer naming convention where all letters are converted to UPPERCASE and words are separated by underscores (for example, API_SECRET_KEY).
What Regex & Tokenization Rule Does CONSTANT_CASE Use?
The converter extracts alphanumeric word segments (/[\p{L}\p{N}]+/gu, splitting camelCase boundaries /(?<=\p{Ll})(?=\p{Lu})/u) and applies words.map(w => w.toUpperCase()).join("_").
- Delimiter Replacement: Spaces, hyphens (
-), and punctuation between words are replaced by a single underscore (U+005F). - Worked Before / After Example: Input
database connection timeout\napi secret key\nmax retry count(9 words, 58 characters, 3 lines) → OutputDATABASE_CONNECTION_TIMEOUT_API_SECRET_KEY_MAX_RETRY_COUNT(1 constant token, 58 characters, 50 letters uppercased, 8 separators converted to_).
| Input Format / Transformation Rule | Input Example (Before) | Output Result (After) | Characters Changed (count) |
|---|---|---|---|
Plain Words → UPPER_SNAKE_CASE |
api secret key (14 chars, 3 words) |
API_SECRET_KEY (14 chars, 1 token) |
12 letters uppercased, 2 spaces → _ |
camelCase → CONSTANT_CASE |
maxRetryCount (13 chars) |
MAX_RETRY_COUNT (15 chars) |
+2 underscores inserted, 11 letters uppercased |
kebab-case → CONSTANT_CASE |
database-timeout-ms (19 chars) |
DATABASE_TIMEOUT_MS (19 chars) |
17 letters uppercased, 2 hyphens → _ |
PascalCase → CONSTANT_CASE |
JwtAuthToken (12 chars) |
JWT_AUTH_TOKEN (14 chars) |
+2 underscores inserted, 9 letters uppercased |
What Are the Standard Conventions for CONSTANT_CASE?
CONSTANT_CASE is universally used in .env configuration files, shell environment variables, and compile-time constants across C, Rust, Python, Java, and JavaScript.
- Environment Variables:
.envfiles and system environment variables (e.g.DATABASE_URL,NODE_ENV). - Global Constants: Constants in JavaScript, Python, C++, Java, and Go to indicate immutable values.
- Redux Action Types: Action identifiers in state management (e.g.
FETCH_USER_SUCCESS).
Is the CONSTANT_CASE Converter Fast, Safe, and Offline?
Yes—all conversions happen locally in your browser so sensitive API key names and environment schemas are never transmitted over the network.
Everything runs on your device. Text Cleaner safely replaces spaces and hyphens with underscores while preserving numbers.