Convert to CONSTANT_CASE

CONSTANT_CASE (also called UPPER_SNAKE_CASE or SCREAMING_SNAKE_CASE) joins your words with underscores and uppercases everything. Paste max retry count and get MAX_RETRY_COUNT. The format is the standard for constants in C, Java, Python, and most languages, and for environment variable names. For the lowercase variant, see snake_case.

Input
Line 1:1 LF cloud_done Saved locally
Result CONSTANT_CASE
0 lines 0 chars

Identifiers for constants and env vars

CONSTANT_CASE is the identifier style for constants and environment variables in almost every language: MAX_RETRY_COUNT, API_BASE_URL, DATABASE_HOST_NAME. Every word is uppercase, separators are single underscores, no other characters appear. This format avoids visual confusion with regular variables and signals "do not modify" at a glance.

The engine tokenises your input the same way as snake_case, then uppercases the joined result. max retry count becomes max_retry_count in the lowercase pass and MAX_RETRY_COUNT after the final toUpperCase(). Mixed-format input (camelCase, kebab-case, dotted) all produces the same constant.

Where it shows up: const declarations in C, C++, Java, JavaScript, and TypeScript; module-level constants in Python (MAX_INT); environment variable names in Unix shells (HOME, PATH, DATABASE_URL); shell script readonly vars; and many config-file keys. For variables, use snake_case; for class names, use PascalCase.

How to use convert to constant_case

  1. 1Paste or type your phrase into the input panel on the left.
  2. 2The CONSTANT_CASE identifier appears in the output panel on the right as you type.
  3. 3Mixed input is fine: maxRetryCount, max-retry-count, and max retry count all produce MAX_RETRY_COUNT.
  4. 4Click Copy in the output header to paste the constant into your code or .env file.
  5. 5For variables, use snake_case; for class names, use PascalCase.

Keyboard shortcuts

Drive TextResult without touching the mouse.

Shortcut Action
Ctrl FOpen the find & replace panel inside the input Plus
Ctrl ZUndo the last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor Plus
EscClose find & replace, or exit fullscreen
Ctrl KOpen the command palette to jump to any tool Plus
Ctrl SSave current workflow draft Plus
Ctrl PRun a saved workflow Plus

What this tool actually does

Word boundary detection

Same tokeniser as camelCase. Underscores, dashes, whitespace, and lowercase-to-uppercase transitions all count as word boundaries, so any input format produces a consistent constant.

Uppercase final pass

After tokenising and joining with underscores, the engine runs toUpperCase() on the entire string. Every letter is mapped to its Unicode uppercase form, so accented letters become uppercase too (café_size -> CAFÉ_SIZE).

Already-formatted input round-trips

Pasting MAX_RETRY_COUNT back in still produces MAX_RETRY_COUNT. The tokeniser splits on the existing underscores, lowercases each token, joins with underscores, and uppercases the result.

Multiple separators collapse

Runs of underscores, dashes, or spaces collapse to a single underscore. max---retry---count and max__retry__count both produce MAX_RETRY_COUNT.

Pairs with the case family

Sibling tools share the same tokeniser. camelCase for variables, PascalCase for classes, snake_case for lowercase variables, kebab-case for URLs, dot.case for namespacing, Train-Case for headers.

Worked example

Spaces, dashes, and camelCase boundaries all collapse to the same CONSTANT_CASE result. The third line shows that PascalCase input is split on lowercase-to-uppercase transitions before being uppercased.

Input
max retry count
api base url
DatabaseHostName
Output
MAX_RETRY_COUNT
API_BASE_URL
DATABASE_HOST_NAME

Settings reference

Input CONSTANT_CASE output
max retry count MAX_RETRY_COUNT
maxRetryCount MAX_RETRY_COUNT
max-retry-count MAX_RETRY_COUNT
max_retry_count MAX_RETRY_COUNT
MAX RETRY COUNT MAX_RETRY_COUNT
maxRetryCount2 MAX_RETRY_COUNT2 (digits stick to their word)

FAQ

Is CONSTANT_CASE the same as SCREAMING_SNAKE_CASE?
Yes. CONSTANT_CASE, UPPER_SNAKE_CASE, and SCREAMING_SNAKE_CASE all refer to the same convention: uppercase words joined with underscores. Style guides differ on the name; the output of this tool matches all three.
Will it work for environment variable names?
Yes. Unix shells expect environment variables in CONSTANT_CASE. The output of this tool is a valid env-var name as long as it does not start with a digit and does not contain non-ASCII characters. For diacritic-free output, run remove accents first.
How is CONSTANT_CASE different from snake_case?
CONSTANT_CASE is uppercase (MAX_RETRY); snake_case is lowercase (max_retry). Both use underscores. Use CONSTANT_CASE for constants and env vars, snake_case for regular variables and functions.
Will it handle camelCase input?
Yes. The tokeniser splits on lowercase-to-uppercase transitions, so maxRetryCount tokenises to max retry count before being joined and uppercased.
What about accented letters?
Accented letters uppercase via Unicode rules. café_size -> CAFÉ_SIZE. If your env-var system rejects non-ASCII, run remove accents on the input first.