CONSTANT_CASE Converter
Convert text to CONSTANT_CASE — uppercase words joined by underscores, for values that never change.
All cases — live preview (click any result to copy it)
Private by design — every conversion runs locally in your browser. Your text is never uploaded, stored or tracked.
CONSTANT_CASE — also known, only half-jokingly, as SCREAMING_SNAKE_CASE — writes words in uppercase joined by underscores: MAX_RETRY_COUNT, DEFAULT_TIMEOUT, API_BASE_URL. It is snake_case shouted, and the shouting is the signal: across C, Java, Python, JavaScript and shell scripting, a name in CONSTANT_CASE announces “this value is fixed; do not reassign it”.
This converter uses the same identifier-aware splitting as the other developer tools on the site, so it works from any starting convention: maxRetryCount, max-retry-count and “max retry count” all become MAX_RETRY_COUNT, and acronym boundaries are respected — userID becomes USER_ID, never USER_I_D.
When to use it
- Naming constants in JavaScript, TypeScript, Java, C and Python
- Environment variable names (DATABASE_URL, SESSION_SECRET) in .env files and CI settings
- Enum values and configuration keys that must stand out in code
- Converting camelCase or phrase names into a constants file
- Shell script variables, where uppercase is the long-standing convention
How it works
- The input is split into real words first — separators, camel humps, acronym boundaries and numbers all mark word edges.
- Every word is uppercased in full.
- The words are joined with single underscores; no leading, trailing or doubled underscores are produced.
- Punctuation and spaces disappear as part of the split, leaving a valid identifier in every mainstream language.
Examples
camelCase input splits at the humps — and “api” stays one word.
The acronym ID is one word, not two single letters.
Good to know
CONSTANT_CASE is one of the oldest naming conventions in computing — it comes from C preprocessor macros, where uppercase names warned programmers that a value was substituted textually and could not be changed at runtime. The convention outlived the macros: Java made it the standard for static final constants, Python's PEP 8 adopted it for module-level constants, and environment variables inherited it from Unix shells. When a name is in CONSTANT_CASE, readers in almost any language community understand it instantly, without a comment.
Two practical notes. First, CONSTANT_CASE is a promise, not a mechanism — in most languages the value can still technically be reassigned, so the convention works because teams respect it. Second, environment variables are the one place the case is not just a convention but effectively a requirement: shells and many tools treat variable names case-sensitively, and lowercase names in .env files are a common source of “works on my machine” bugs. Converting names here removes that class of error before it starts.
Frequently asked questions
Is CONSTANT_CASE the same as SCREAMING_SNAKE_CASE?
Yes — they are two names for the same convention: uppercase words joined by underscores. CONSTANT_CASE describes its purpose (constants); SCREAMING_SNAKE_CASE describes its look (snake_case, but loud).
When should a name be in CONSTANT_CASE?
When the value is fixed for the life of the program: limits, timeouts, configuration, environment variables, enum members in some languages. If a value is expected to change, use snake_case or camelCase instead — the case is a signal to other developers.
How does it handle text that is already camelCase or PascalCase?
The splitter finds the word boundaries inside the identifier, so maxRetryCount and MaxRetryCount both become MAX_RETRY_COUNT, and acronyms stay intact as single words.
Are environment variable names case-sensitive?
On Linux and macOS, yes — DATABASE_URL and database_url are different variables. CONSTANT_CASE is the universal convention for them, and this converter produces names that are safe in shells, .env files and CI dashboards.
Is my text uploaded or stored?
No. The conversion runs entirely in your browser. Nothing you type is sent to a server, stored or logged — safe for configuration names and schemas.