Constant Case Converter — Transform Text to CONSTANT_CASE Instantly
This CONSTANT_CASE converter — also called SCREAMING_SNAKE_CASE or MACRO_CASE — turns any description into an all-caps, underscore-separated identifier: "max retry count" becomes "MAX_RETRY_COUNT" instantly. The all-caps visual signal means: this value must not be reassigned. Python's PEP 8 mandates CONSTANT_CASE (UPPER_CASE_WITH_UNDERSCORES) for all module-level constants. Java uses CONSTANT_CASE for static final fields — Integer.MAX_VALUE, HttpStatus.OK, Collections.EMPTY_LIST. C and C++ use it for #define macros: MAX_BUFFER_SIZE, NULL, EOF. Unix shell and every major CI/CD platform (GitHub Actions, Docker Compose, Kubernetes env vars) use CONSTANT_CASE exclusively for environment variables: NODE_ENV, DATABASE_URL, API_SECRET_KEY. Redux Toolkit recommends SCREAMING_SNAKE_CASE for action type strings: FETCH_USER_SUCCESS, CART_ITEM_REMOVED. No signup, no character limit.
What is CONSTANT_CASE?
The CONSTANT_CASE converter uppercases every letter and joins words with underscores — "database url" becomes "DATABASE_URL" instantly. Use it for .env environment variables, programming constants, Java enum values, and C/C++ macros. PEP 8, Google's Java Style Guide, and every major language convention require CONSTANT_CASE for values that should never be reassigned.
hello world example→HELLO_WORLD_EXAMPLEKey Features
Accepts snake_case, kebab-case & Plain English
Paste "max-retry-count", "max_retry_count", or "max retry count" — all produce "MAX_RETRY_COUNT". Hyphens, underscores, and spaces are all treated as word separators.
Handles camelCase & PascalCase Input
"maxRetryCount" or "MaxRetryCount" → "MAX_RETRY_COUNT". Word boundaries in camelCase and PascalCase are detected and split automatically before uppercasing.
Safe for API Keys, Secrets, and Pre-Deployment Config Names
Your API keys, environment variable names, and configuration constants never leave your device. Nothing is transmitted to any server.
.env and Docker ENV Ready — POSIX Shell-Compatible Output
POSIX shell, dotenv, Docker Compose ENV, Heroku Config Vars, GitHub Actions secrets, and AWS Parameter Store all require CONSTANT_CASE environment variable names. Output is shell-safe — no quoting or escaping required for direct assignment in .env files.
Before & After: CONSTANT_CASE Examples
Real input → output pairs showing exactly how the converter behaves
| Input | CONSTANT_CASE Output |
|---|---|
maximum retry count | MAXIMUM_RETRY_COUNT |
API base URL | API_BASE_URL |
database connection timeout | DATABASE_CONNECTION_TIMEOUT |
fetch user success | FETCH_USER_SUCCESS |
node environment | NODE_ENVIRONMENT |
When to Use CONSTANT_CASE
Use CONSTANT_CASE for values that never change at runtime: environment variables (DATABASE_URL, API_KEY), global constants (MAX_RETRY_COUNT), enum values, configuration flags, and C/C++ macros.
Do not use CONSTANT_CASE for variables that change at runtime, function names, class names, or regular object properties. Its visual weight signals "this never changes" — overusing it creates confusion.
CONSTANT_CASE vs Other Formats
| Format | Example | Best For |
|---|---|---|
| CONSTANT_CASE | MAX_RETRY_COUNT | Environment variables, Python module constants, Java static finals, C macros, Redux action types, TypeScript enums |
| snake_case | max_retry_count | Python variables/functions, SQL column names, database schemas, Rust identifiers — mutable values at any scope |
| camelCase | maxRetryCount | JavaScript/TypeScript variables, function names, JSON keys, local variables in Java/Kotlin — mutable runtime values |
| PascalCase | MaxRetryCount | React components, TypeScript classes/interfaces, Java/C# class names, Go exported identifiers |
Who Should Use This Tool?
Convert configuration key names and deployment setting descriptions into CONSTANT_CASE environment variable names for .env files, GitHub Actions secrets, Docker Compose env vars, and Kubernetes ConfigMaps.
Generate PEP 8-compliant module-level constant names and Java static final field names from plain English descriptions in design documents and requirements specs.
Create Redux action type strings, TypeScript enum member names, and configuration object keys in the SCREAMING_SNAKE_CASE convention expected by Redux Toolkit and most TypeScript style guides.
Industry Standard
CONSTANT_CASE is specified in the Google Java Style Guide, PEP 8 (Python), and the GNU Coding Standards for constants and macros. The POSIX standard uses CONSTANT_CASE for all environment variable names (PATH, HOME, USER, DATABASE_URL).
CONSTANT_CASE Rules: How It Works
- →Every letter converted to uppercase
- →Spaces, hyphens, and camelCase boundaries replaced with underscores — "max retry count" → "MAX_RETRY_COUNT"
- →Punctuation and symbols stripped
- →Numbers kept in place — "section 2 limit" → "SECTION_2_LIMIT"
- ×Regular mutable variables — CONSTANT_CASE signals immutability; misleads other developers
- ×CSS class names or HTML attributes — use kebab-case (.btn-primary)
- ×Function or method names — use camelCase (getMaxValue)
- ×Database table or column names — use snake_case (user_id)
How to Use This CONSTANT_CASE Converter
- Paste or type your text into the Input Text box on the left.
- The output is converted to CONSTANT_CASE instantly on the right.
- Click Copy to copy the result to your clipboard.
- Use Clear to reset and convert new text.
Key Use Cases
- →Convert deployment configuration descriptions from README docs or Notion pages into CONSTANT_CASE environment variable keys for .env files, GitHub Actions secrets, Docker Compose environment sections, and Kubernetes ConfigMap data fields. All Unix shell environments use CONSTANT_CASE: NODE_ENV, DATABASE_URL, API_SECRET_KEY, REDIS_HOST, JWT_SECRET.
- →Generate Redux action type strings following the SCREAMING_SNAKE_CASE convention that Redux Toolkit recommends for slice action names. "fetch user profile success" → "FETCH_USER_PROFILE_SUCCESS". Consistent action type naming prevents the silent string-matching bugs that occur when "FETCH_USER_SUCCESS" and "fetchUserSuccess" are used interchangeably.
- →Transform Python module-level constant names from plain English to PEP 8-compliant CONSTANT_CASE. PEP 8 states: "Constants are usually defined on a module level and written in all capital letters with underscores separating words. Examples: MAX_OVERFLOW, TOTAL." This is enforced by flake8-bugbear (B006) and pylint in many projects.
- →Create Java static final field names from business rule and configuration descriptions. Java uses CONSTANT_CASE for all static final fields: Integer.MAX_VALUE, HttpStatus.OK, Collections.EMPTY_LIST. Private static finals in a class also conventionally use CONSTANT_CASE to signal that the value is fixed for the lifetime of the class.
- →Build TypeScript enum member names in CONSTANT_CASE for state machine events, permission sets, and API status codes. TypeScript does not enforce enum member casing, but CONSTANT_CASE is the widely recommended convention: enum Direction { NORTH, SOUTH, EAST, WEST } and enum HttpMethod { GET = "GET", POST = "POST", PUT = "PUT" }.
CONSTANT_CASE in Programming Languages
const MAX_RETRIES = 3;MAX_RETRIES = 3static final int MAX_RETRIES = 3;#define MAX_RETRIES 3DATABASE_URL=postgres://localhost/mydbThis Converter vs Manual Methods
| Method | Limitation |
|---|---|
| Manual typing in the editor | Error-prone — easy to forget an underscore or miss uppercasing a letter in long constant names |
| VS Code "Transform to Uppercase" command | Only uppercases; does not replace spaces with underscores or detect camelCase boundaries — result is "MAX RETRY COUNT" not "MAX_RETRY_COUNT" |
| Python text.upper().replace(" ", "_") | Only handles spaces; fails on camelCase, kebab-case input, or strings with punctuation |
| Regex in terminal (sed/awk) | Requires separate passes for camelCase splitting and uppercasing; complex to maintain across all edge cases |
| This converter | None — free, instant, browser-based, handles all input formats and detects camelCase word boundaries |
Common Mistakes & Pro Tips
- !Using CONSTANT_CASE for regular mutable variables — the convention exists specifically to signal immutability and global scope. Naming a mutable variable USER_INPUT or CURRENT_COUNT in CONSTANT_CASE misleads other developers into thinking it's a fixed configuration value, which is a well-known cause of bugs in large codebases. Reserve CONSTANT_CASE strictly for values that will never change at runtime.
- !Confusing CONSTANT_CASE with snake_case for Python constants — PEP 8 explicitly distinguishes them: regular variables and function parameters use snake_case (user_count, max_items); module-level constants use CONSTANT_CASE (MAX_OVERFLOW, DATABASE_URL, TOTAL). Many developers mistakenly use snake_case for constants ("max_retry_count = 3") which is technically valid Python but signals mutability to other readers.
- !Using CONSTANT_CASE inside a function or local scope — in Python and JavaScript, CONSTANT_CASE is a convention for module-level or class-level constants, not for local variables inside a function. Writing MAX_ATTEMPTS = 5 inside a function body is misleading — it suggests a global configuration value rather than a local limit. Use regular variable names (max_attempts = 5) for local scope.
Frequently Asked Questions
Everything you need to know about CONSTANT_CASE
What is SCREAMING_SNAKE_CASE and why is it called that?
+
SCREAMING_SNAKE_CASE is an informal but widely used name for CONSTANT_CASE — all uppercase letters (the "screaming") with underscores between words (the "snake"). The name captures both visual characteristics: the all-caps shouts for attention, signaling importance and immutability, while the underscores connect words in the snake_case pattern. It is also called MACRO_CASE in C/C++ contexts (where it's used for #define macros). The term is used humorously in developer discussions but describes a real and serious convention used across virtually every programming language.
Which languages use CONSTANT_CASE for constants?
+
The convention is nearly universal: C/C++ for #define macro names (MAX_BUFFER_SIZE, NULL, EOF), Python for module-level constants per PEP 8 (MAX_OVERFLOW, DATABASE_URL, TOTAL), Java for static final fields (Integer.MAX_VALUE, HttpStatus.OK, Collections.EMPTY_LIST), JavaScript/TypeScript for configuration constants and Redux action types (FETCH_USER_SUCCESS, API_BASE_URL), PHP for class constants and global defines, Kotlin for companion object constants, Go for exported package-level constants, and Unix shell for all environment variables (PATH, HOME, NODE_ENV). It is one of the most cross-language consistent conventions in software development.
Should I use CONSTANT_CASE for all TypeScript "const" declarations?
+
No — only for values that are genuinely fixed configuration or literal values that will not change at runtime. In TypeScript, "const" is a binding declaration: the variable reference is fixed, but an object's properties can still be mutated. Reserve CONSTANT_CASE for string literals used as action types ("FETCH_USER_SUCCESS"), numeric limits (MAX_ITEMS = 100), and environment variable names (DATABASE_URL). For a regular const holding a computed value or local variable, camelCase is the right choice: const userCount = getCount().
How do environment variables use CONSTANT_CASE?
+
All Unix shell environment variables are conventionally CONSTANT_CASE: PATH, HOME, NODE_ENV, DATABASE_URL, API_SECRET_KEY, REDIS_HOST, JWT_SECRET. The convention exists because shell variables are case-sensitive and all-caps visually distinguishes environment variables from local shell variables. In .env files used by Node.js (via the dotenv library), Docker Compose (env_file), GitHub Actions (env: and secrets:), and Kubernetes (ConfigMap and Secret data fields), every key is expected to be CONSTANT_CASE. Breaking this convention causes subtle bugs when tools auto-load variables and expect the CONSTANT_CASE format.
What happens to punctuation and special characters during conversion?
+
The converter strips all non-alphanumeric characters, treats hyphens and underscores as word separators, splits camelCase boundaries, replaces all word separators with underscores, and uppercases every letter. "API base URL (v2)" → "API_BASE_URL_V2". "max-retry-count" → "MAX_RETRY_COUNT". "userProfileCard" → "USER_PROFILE_CARD". Apostrophes, parentheses, slashes, periods, and currency signs are removed. If your input contains meaningful version numbers or abbreviations, verify that the output is still readable and unambiguous after conversion.
What is the difference between CONSTANT_CASE and snake_case?
+
Both use underscores to separate words and are closely related — CONSTANT_CASE is simply snake_case written in ALL CAPS. The difference is semantic: snake_case (user_first_name, get_user) signals a mutable variable or function name used at runtime. CONSTANT_CASE (MAX_RETRY_COUNT, DATABASE_URL) signals a fixed, immutable value — a configuration constant that should never be reassigned during program execution. PEP 8 distinguishes them explicitly: snake_case for functions and variables, UPPER_CASE_WITH_UNDERSCORES for module-level constants. Both are valid identifiers in Python, JavaScript, Java, and most other languages — the difference is purely conventional, not syntactic.
How do I convert to CONSTANT_CASE in VS Code, Python, or GitHub Actions?
+
In VS Code, the "Transform to Uppercase" command only uppercases letters — it does not add underscores. To get proper CONSTANT_CASE from a space-separated string in VS Code, you would need the "Change Case" extension. In Python: use "MAX_RETRY_COUNT".upper() for literals already in the right format, or re.sub(r"(?<!^)(?=[A-Z])", "_", camel).upper() for camelCase input. In GitHub Actions, all environment variables in env: blocks and secrets are expected to already be CONSTANT_CASE — the platform does not auto-convert. For any source text — plain English, camelCase, or kebab-case — this browser converter is the fastest single-step path to a valid CONSTANT_CASE identifier.