SCREAMING_SNAKE_CASE Converter (Live Constant & .env Tool)
Convert text, camelCase, and kebab-case into ALL-CAPS SCREAMING_SNAKE_CASE (Constant Case). Format environment variables for .env files, Docker configurations, C macros, and Python global constants in real time.
SCREAMING_SNAKE_CASE (also known as Constant Case, Macro Case, or UPPER_SNAKE_CASE) is a programming naming convention where all letters are capitalized and words are separated by underscores (e.g., MAX_BUFFER_SIZE). It is the universal standard for environment variables, global constants, and POSIX configuration flags.
Where SCREAMING_SNAKE_CASE is Standard in Software Engineering
While camelCase and snake_case are used for dynamic variables and functions, SCREAMING_SNAKE_CASE signals immutability, environment settings, and global scope:
- Environment Variables (POSIX / Linux / Docker): System configuration files like
.envand Docker Compose define variables in uppercase snake case:DATABASE_URL=postgres://user:pass@localhost:5432/db - C and C++ Preprocessor Macros: In systems programming, macro definitions and constants are capitalized to prevent collisions with function names:
#define MAX_BUFFER_SIZE 1024 - Python Global Constants (PEP 8): Python's official style guide enforces all-caps with underscores for constants defined at the module level:
MAX_RETRY_ATTEMPTS = 5 - Redux / State Management Action Types: In React Redux and flux architectures, action type constants are written in constant case to prevent spelling typos:
export const FETCH_USER_PROFILE_SUCCESS = 'FETCH_USER_PROFILE_SUCCESS';
Complete Programming Case Conventions Matrix
| Case Convention | Visual Structure | Primary Software Use Case | Standard Example |
|---|---|---|---|
| SCREAMING_SNAKE_CASE | ALL_CAPS with underscores | Environment variables, C macros, global constants | API_SECRET_KEY |
| PascalCase | Initial capital, no spaces | React components, TypeScript classes, C# models | ApiSecretKey |
| camelCase | Initial lowercase, subsequent words capitalized | JavaScript variables, JSON keys, method names | apiSecretKey |
| snake_case | All lowercase with underscores | Python variables, SQL database columns | api_secret_key |
| kebab-case | All lowercase with hyphens | CSS classes, URL permalinks, HTML custom elements | api-secret-key |
Programmatic Implementation in JavaScript and Python
To convert identifiers to SCREAMING_SNAKE_CASE programmatically inside your build scripts:
JavaScript:
function toScreamingSnakeCase(str) {
return str
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
.replace(/([a-z\d])([A-Z])/g, '$1_$2')
.replace(/[-\s.]+/g, '_')
.toUpperCase();
}
console.log(toScreamingSnakeCase('databaseHostPort')); // "DATABASE_HOST_PORT"
Python:
import re
def to_screaming_snake_case(text):
s = re.sub(r'([A-Z]+)([A-Z][a-z])', r'\1_\2', text)
s = re.sub(r'([a-z\d])([A-Z])', r'\1_\2', s)
return re.sub(r'[-\s.]+', '_', s).upper()
print(to_screaming_snake_case('maxRequestCount')) # "MAX_REQUEST_COUNT"
Related Developer Case Converters:
- PascalCase Converter — Convert strings to UpperCamelCase for React components and TypeScript classes.
- CamelCase to Snake_Case Converter — Format JavaScript variables for Python and SQL schemas.
- Snake_Case to CamelCase Converter — Convert SQL database columns into TypeScript properties.
- Kebab-Case to CamelCase Converter — Transform CSS properties into React/JSX inline style objects.
- Full Case Converter Hub — Standardize text into UPPERCASE, lowercase, and Title Case.
- Programming Naming Conventions Guide — Industry standards across modern languages.
Frequently Asked Questions
What is the difference between snake_case and SCREAMING_SNAKE_CASE?
Both conventions separate words using underscores. However, standard snake_case is entirely lowercase (user_account_id), commonly used for database columns and Python variables, while SCREAMING_SNAKE_CASE is entirely uppercase (USER_ACCOUNT_ID), used for constants and environment variables.
Why are environment variables always written in uppercase snake case?
Under POSIX standards and Unix conventions, operating system environment variables are capitalized to distinguish global system-level settings (like PATH or PORT) from local script variables.
What is another name for SCREAMING_SNAKE_CASE?
SCREAMING_SNAKE_CASE is also widely referred to as Constant Case, Macro Case, or UPPER_SNAKE_CASE.
How does this tool handle numbers in variable names?
Numbers are treated as boundary transitions. For example, v2ApiEndpoint converts cleanly to V2_API_ENDPOINT without creating duplicate underscores.
Is my data stored or logged on a server?
No. All text transformations execute 100% locally inside your browser's runtime memory using JavaScript. No environment variable keys, tokens, or strings are sent across a network or saved in an external database.