What is CONSTANT_CASE?
CONSTANT_CASE (also called SCREAMING_SNAKE_CASE, MACRO_CASE, or simply UPPER_SNAKE_CASE) uses all uppercase letters with underscores between words. It's the convention for compile-time constants, environment variables, and preprocessor macros in most languages.
The visual loudness signals "this value doesn't change at runtime", which is useful for spotting magic numbers, configuration keys, and API tokens at a glance.
When to use CONSTANT_CASE
- Compile-time constants in C, C++, Java, C#, Python, Ruby, JavaScript.
- Environment variables:
DATABASE_URL,API_KEY,MAX_RETRIES. - C macros and preprocessor directives:
#define MAX_BUFFER_SIZE 1024. - Configuration keys in ini-style files.
- Enum members in some style guides: though many languages now prefer PascalCase for enum members.
- HTTP header names in CGI variables:
HTTP_USER_AGENT.
How CONSTANT_CASE conversion works
- Input is tokenized using the smart tokenizer.
- Each word is uppercased.
- Words are joined with a single underscore between them.
Worked examples
| Input | CONSTANT_CASE |
|---|---|
max retry count |
MAX_RETRY_COUNT |
api base url |
API_BASE_URL |
default timeout |
DEFAULT_TIMEOUT |
is production mode |
IS_PRODUCTION_MODE |
Related case formats
snake_case
→ Convert text to snake_case
UPPERCASE→ Convert text to UPPERCASE
kebab-case→ Convert text to kebab-case
Need more conversion options?
Open the full converter →