Phrasit

Search Phrasit

Search every tool, guide, and citation page.

1,900 US SEARCHES / MONTH

Text to CONSTANT_CASE converter

Convert any phrase into CONSTANT_CASE for constants and env vars. Developers use a CONSTANT_CASE converter to turn labels and names into uppercase underscore-joined identifiers for constants, enum members, and environment variables. It produces a valid screaming-snake-case name in one paste, matching the convention most languages use for fixed values.

Example

Input to output
Input

max retry count

Output

MAX_RETRY_COUNT

Text to CONSTANT_CASE conversion splits the input into words, uppercases every letter, and joins the words with underscores. Use it for constants, enum values, and environment variables. For example, max retry count becomes MAX_RETRY_COUNT.

0 characters

Text to CONSTANT_CASE guide

What CONSTANT_CASE is and what it signals

CONSTANT_CASE writes a multi-word name in all uppercase letters with underscores between the words: MAX_RETRY_COUNT, API_BASE_URL, DEFAULT_TIMEOUT_MS. It is the same shape as snake_case but capitalized, which is why it is also called SCREAMING_SNAKE_CASE or upper snake case. The all-caps styling is a deliberate visual signal: in nearly every language, a name in this form tells the reader that the value never changes at runtime.

The convention spans many ecosystems. In Java, C#, and Python, module-level constants and enum members are conventionally CONSTANT_CASE, so a fixed value like the maximum number of retries reads as MAX_RETRIES. In JavaScript and TypeScript the convention is looser but still common for true constants and configuration keys. The most universal use is environment variables: shells, Docker, CI systems, and the twelve-factor app methodology all expect names like DATABASE_URL, NODE_ENV, and STRIPE_SECRET_KEY in this exact form, because POSIX environment variable names are conventionally uppercase with underscores.

How the converter builds a CONSTANT_CASE name

The conversion is two steps. First the input is split into words at every boundary: spaces, existing underscores or hyphens, dots, and the capital letters inside a camelCase or PascalCase identifier. So a plain phrase, a kebab-case flag, or a camelCase variable all split correctly. Second, every word is uppercased and the words are joined with a single underscore.

So "max retry count" becomes MAX_RETRY_COUNT, "apiBaseUrl" becomes API_BASE_URL, and "default-timeout-ms" becomes DEFAULT_TIMEOUT_MS. Leading and trailing whitespace is trimmed and runs of separators collapse to one underscore, so the result is always a clean uppercase token. Because environment variable names cannot start with a digit and should avoid most punctuation, the converter's clean alphanumeric-and-underscore output is well suited to that use.

One thing to check after conversion is digits and units. "timeout 30 s" becomes TIMEOUT_30_S, which may not be what you want; you might prefer TIMEOUT_30S or TIMEOUT_SECONDS. Acronyms are already uppercase so they cause no trouble here, which makes CONSTANT_CASE one of the cleaner conversions, but it is still worth reading the output once before pasting it into a config file or a secret manager.

When you need a CONSTANT_CASE converter

The most frequent use is naming environment variables and configuration keys. A spec or a third-party service tells you to set "Stripe secret key" and "Database connection string"; you need STRIPE_SECRET_KEY and DATABASE_CONNECTION_STRING for the .env file, the deployment dashboard, or the CI secrets store. Converting the human names in one paste keeps them consistent and avoids the typos that cause an app to read the wrong variable and fail silently.

Defining constants and enums in code is the other driver. When you turn a list of fixed statuses or settings from a spec into enum members or top-level constants, each label needs to become a CONSTANT_CASE name: "Pending review" becomes PENDING_REVIEW, "Maximum upload size" becomes MAXIMUM_UPLOAD_SIZE. Doing the whole list at once is faster and more reliable than retyping each name in caps.

Paste your words or an existing identifier into the live converter above to get the CONSTANT_CASE form immediately. The side panel shows snake_case next to it, so if the same name is needed both as a constant and as a lowercase variable you can copy each in one step.