Constant Case Converter — Free Online Tool
What is Constant Case Converter?
Constant Case (CONSTANT_CASE), also known as SCREAMING_SNAKE_CASE or UPPER_SNAKE_CASE, converts text to all uppercase letters separated by underscores. The result looks like THIS_IS_CONSTANT_CASE.
It is the universal convention for naming constants and environment variables across nearly all programming languages and deployment platforms. case — into properly formatted CONSTANT_CASE output.
When to use Constant Case Converter?
env files and Docker configurations. Python developers name module-level constants in CONSTANT_CASE per PEP 8 (MAX_RETRIES, API_TIMEOUT). PHP uses define() with CONSTANT_CASE for global constants. Java and C# use it for static final fields.
JavaScript and TypeScript developers define frozen configuration values this way. If you need lowercase underscores instead, use the Snake Case Converter. For all-uppercase hyphens (COBOL style), try the COBOL-CASE Converter.
How to use this tool
- 1Paste your text
- 2Click 'Convert' to get CONSTANT_CASE
- 3Copy for your constants and environment variables
The converter automatically detects word boundaries from spaces, hyphens, dots, and camelCase transitions, then joins the uppercased words with underscores.
Examples
| Input | Output |
|---|---|
| database host | DATABASE_HOST |
| apiKey | API_KEY |
| max retry count | MAX_RETRY_COUNT |
| background-color | BACKGROUND_COLOR |
| Hello World | HELLO_WORLD |
Rules & Behavior
- All words are converted to UPPERCASE letters. Every letter in the output is capitalised regardless of the input format.
- Words are separated by underscores (_). This is the same structure as snake_case but with all letters in uppercase, which is why it is also called UPPER_SNAKE_CASE.
- Special characters and punctuation are removed. Only letters (A–Z), numbers (0–9), and underscores remain in the output, making it valid for environment variables and constant names in most languages.
Related Tools
Frequently Asked Questions
What is CONSTANT_CASE?
CONSTANT_CASE (also called SCREAMING_SNAKE_CASE or UPPER_SNAKE_CASE) uses all uppercase letters with underscores between words, like MAX_RETRY_COUNT or DATABASE_URL. It is the standard naming convention for constants and environment variables across Python, Java, JavaScript, PHP, C, and virtually every other programming language.
When should I use CONSTANT_CASE?
Use it for constants in Python (MAX_VALUE), PHP (define('DB_HOST', 'localhost')), environment variables (DATABASE_URL, API_KEY), Java static final fields, and .env configuration files. DevOps engineers use it for Docker environment variables and CI/CD pipeline configuration.
Why is it called SCREAMING_SNAKE_CASE?
Regular snake_case uses lowercase letters — it is 'quiet'. SCREAMING_SNAKE_CASE uses all uppercase letters, making it appear to 'shout'. The metaphor comes from the internet convention where all-caps text is perceived as shouting. Both use the same underscore-separated structure.
Is it the same as snake_case?
They share the same structure — underscores between words — but differ in letter casing. snake_case is all lowercase (used for variables and functions), while CONSTANT_CASE is all uppercase (used for constants and environment variables). The casing difference signals the value's semantic role in your code.
Can I convert from camelCase to CONSTANT_CASE?
Yes. The tool detects camelCase and PascalCase boundaries, splits the words, converts them to uppercase, and joins them with underscores. For example, apiResponseHandler becomes API_RESPONSE_HANDLER and maxRetryCount becomes MAX_RETRY_COUNT.