toolqik

172 · Text

Constant Case Converter

Convert names to CONSTANT_CASE for constants and environment variables.

Runs in your browser
Constant Case

  

About this tool

CONSTANT_CASE, also called SCREAMING_SNAKE_CASE, writes words in capitals joined by underscores: MAX_RETRY_COUNT. It marks values that never change, such as constants in JavaScript, Java, C, Python and PHP, and it’s the universal style for environment variables (DATABASE_URL, API_BASE_URL). Paste names in any style, one per line.

CaseExampleTypical use
camelCaseuserProfileIdJavaScript, Java and C# variables and functions; JSON keys
PascalCaseUserProfileIdClasses and types in most languages; C# methods; React components
snake_caseuser_profile_idPython, Ruby and Rust variables; database columns
kebab-caseuser-profile-idURLs, CSS classes, HTML attributes, file names, CLI flags
CONSTANT_CASEUSER_PROFILE_IDConstants and environment variables

How words are detected

Input can be in any style: spaces, snake_case, kebab-case, camelCase or PascalCase. Words are split at spaces, underscores, hyphens and other punctuation, at lowercase-to-uppercase changes (userId → user, Id), and at acronym boundaries (XMLHttpRequest → XML, Http, Request). Each line is converted separately, so you can paste a whole list of names at once. Letters with accents and non-Latin scripts are kept.

Environment variable names

POSIX shells only reliably accept letters, digits and underscores in variable names, and names can’t start with a digit. CONSTANT_CASE fits those rules, which is why .env files, Docker, Kubernetes and CI systems all use it. Many frameworks map nested settings with a double underscore: Logging__LogLevel__Default in .NET, for example.

Examples

maxRetryCount        → MAX_RETRY_COUNT
api-base-url         → API_BASE_URL
HTTPTimeoutSeconds   → HTTP_TIMEOUT_SECONDS
stripe secret key    → STRIPE_SECRET_KEY

FAQ

What is CONSTANT_CASE?

Uppercase words joined by underscores, like MAX_RETRY_COUNT. It is used for constants and environment variables.

Is CONSTANT_CASE the same as SCREAMING_SNAKE_CASE?

Yes, they are two names for the same style.

How do I convert camelCase to CONSTANT_CASE?

Paste the names, one per line. maxRetryCount becomes MAX_RETRY_COUNT.

Why do environment variables use CONSTANT_CASE?

Shells accept only letters, digits and underscores in variable names, and uppercase names avoid clashing with ordinary shell variables, which are lowercase by convention.

esc
↑↓ navigate↵ open