camelCase to CONSTANT_CASE converter

Turn camelCase variable names into the all-caps, underscore-separated style used for constants.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter camelcase names (one per line or inside text).
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

Each camelCase name is split into words at every change from a lowercase letter or digit to a capital, and before the last capital of an acronym that is followed by a lowercase letter. The words are then upper-cased and joined with underscores (_). Symbols and spaces around the names are left as they are. Example: maxRetryCount becomes MAX_RETRY_COUNT.

Example

Result: CONSTANT_CASE result: MAX_RETRY_COUNT API_BASE_URL DEFAULT_TIMEOUT_MS; Names processed: 3.

maxRetryCount
apiBaseUrl
defaultTimeoutMs
MAX_RETRY_COUNT
API_BASE_URL
DEFAULT_TIMEOUT_MS

Limits and caveats

  • A name with no capital to mark the word break, such as username or an Arabic name, cannot be split.
  • Every word in the pasted text is converted, including keywords and library names, so review the result before pasting it into code.

Questions about this tool

What is CONSTANT_CASE?

Capitalised words separated by underscores, also called SCREAMING_SNAKE_CASE, commonly used for constant names in JavaScript, Java and Python.

How are digits handled?

A digit stays attached to the letters before it, so apiKeyV2 becomes API_KEY_V2 and item2Count becomes ITEM2_COUNT.

Are standalone numbers counted as names?

No, in apiKeyV2 = 1 only the name changes, the 1 stays as it is, and one name is counted.