Case Converter

Paste identifiers on the left, one per line for a list. The examples in the title bar only fill the editor. Naming styles along the bottom split each line into words; UPPER, lower, and sentence case change letters and keep the separators.

How an identifier is split, then spelled again

camelCase, PascalCase, snake_case, kebab-case, and CONSTANT_CASE are different spellings of the same word list. A converter is only correct if it finds the same boundaries a reader would: a lowercase or digit before an uppercase letter, plus underscores, hyphens, and spaces.

JSON keys often follow one convention and CSS classes another. Compare the object in the JSON formatter and the selectors in the CSS formatter when a payload and a stylesheet disagree on the same name.

Word boundaries and the five compound styles

Where a compound name is cut into words

  1. A lowercase letter or digit followed by an uppercase letter is a camel boundary (myVar, version2Name).
  2. Runs of underscores or hyphens become a single gap (hello_world-example).
  3. Spaces and line breaks are gaps too; each line is converted on its own.
  4. A run of capitals with no lowercase before the next capital stays one token (HTTPResponse).

How camel, Pascal, snake, kebab, and constant rejoin words

  1. camelCase lowercases the first word and capitalizes the rest (userProfileId).
  2. PascalCase capitalizes every word and concatenates them (UserProfileId).
  3. snake_case lowercases every word and joins with underscores (user_profile_id).
  4. kebab-case uses hyphens; CONSTANT_CASE is snake_case written in capitals (USER_PROFILE_ID).

Why UPPER, lower, and sentence case do not retokenize

  1. Those three styles change letters in the original string and leave _, -, and spaces where they were.
  2. hello_world in UPPERCASE is HELLO_WORLD, not a new word list.
  3. Sentence case lowercases the whole text and capitalizes only the first character.
  4. Title Case is the exception: it splits words, then capitalizes each one and joins with spaces.

Why acronyms and digits do not always match a human split

  1. HTTPResponse has no lowercase-before-uppercase cut, so it becomes one word, httpresponse, in camelCase.
  2. XMLHttpRequest does split, because the lowercase p and l sit before the next capital: xmlHttpRequest.
  3. Digits stick to the word before them unless an uppercase letter follows (userID2 → user, ID2).
  4. If a team keeps HTTP as its own word, insert a separator before converting.

Where the spelling actually matters

API fields crossing languages

Python and PostgreSQL often use snake_case; TypeScript objects usually use camelCase. Convert the key list at the boundary.

CSS classes and env keys

kebab-case is normal in stylesheets; CONSTANT_CASE is normal in environment variables. The words stay the same.

Frequently asked questions

How do I convert snake_case to camelCase?
user_profile_id becomes userProfileId. Underscores are word gaps; the first word stays lowercase.
What is the difference between camelCase and PascalCase?
Both drop separators. camelCase leaves the first word lowercase (myVariable). PascalCase capitalizes every word (MyVariable).
When is snake_case safer than kebab-case?
snake_case is a legal identifier in Python and a common SQL column form. A hyphen is subtraction in those languages, so kebab-case belongs in URLs and CSS class names.
What is CONSTANT_CASE?
The same words as snake_case, written in capitals: hello world → HELLO_WORLD. UPPERCASE of hello_world is also HELLO_WORLD, but UPPERCASE of hello world keeps the space.
Does UPPERCASE split camelCase?
No. helloWorld becomes HELLOWORLD. Use CONSTANT_CASE when you want HELLO_WORLD.
Why does HTTPResponse become one word?
Consecutive capitals are not a boundary. HTTPResponse has no lowercase letter before an uppercase letter, so camelCase yields httpresponse. HTTPResponseCode still splits before Code, because e is lowercase and C is uppercase: httpresponseCode.
Are multiple lines converted separately?
Yes for camel, Pascal, snake, kebab, constant, and title. Each line is its own identifier. UPPER, lower, and sentence case still treat the whole text as one string.
Which spelling belongs on a JSON key?
Match the producer. Browser APIs usually use camelCase; many Python services use snake_case. Mixing both on one object breaks lookups. Inspect the payload in the JSON formatter.