PascalCase to camelCase converter

Turn PascalCase class and type names into camelCase to use them as variable or instance names.

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 pascalcase names (one per line or inside text) and keep acronyms in capitals (such as html and id).
  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 PascalCase 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 first word is then lowercased and each following word starts with a capital, with no separator. With the acronym option on, all-capital words such as ID stay as they are when the name also has lowercase letters. Symbols and spaces around the names are left as they are. Example: UserProfile becomes userProfile.

Example

Inputs: Keep acronyms in capitals (such as HTML and ID) = yes. Result: camelCase result: userProfile xmlHttpRequest getUserID; Names processed: 3.

UserProfile
XMLHttpRequest
GetUserID
userProfile
xmlHttpRequest
getUserID

Limits and caveats

  • A name with no capital to mark the word break, such as username or an Arabic name, cannot be split.
  • Digits stay attached to the letters before them, so item2Count is read as item2 and Count.

Questions about this tool

Why does XMLHttpRequest become xmlHttpRequest and not xMLHttpRequest?

The acronym at the start is one word, and camelCase writes the whole first word in lowercase.

What does the acronym option do?

It decides how acronyms after the first word look: with it on, GetUserID becomes getUserID; with it off, getUserId.

When do I turn a class name into camelCase?

When naming a variable that holds an instance of the class, as in const userProfile = new UserProfile(), a common convention in JavaScript and Java.