U.UtilityApp
✍️ TextFree · No signup

camelCase Converter

Convert text or phrases into camelCase for variable names and code.

How your text becomes one camelCase name

The converter first breaks your text into words. It splits on spaces, line breaks, hyphens and underscores, and also where a lowercase letter is directly followed by a capital. Then it lowercases every word, gives each word after the first a capital first letter, and joins them with nothing in between.

InputcamelCase
user first nameuserFirstName
First NamefirstName
get-user-by-idgetUserById
snake_case_namesnakeCaseName
total_amount-due nowtotalAmountDueNow
getUserByIdgetUserById

Text that is already in camelCase comes back unchanged, so it is safe to paste a mix of styles.

Acronyms get flattened

Because each word is lowercased before its first letter is raised, a word typed in capitals loses them. Sometimes that's what you want, sometimes not:

  • HTML parser becomes htmlParser and user ID becomes userId.
  • XMLHttpRequest becomes xmlhttpRequest, because there is no lowercase letter between the capitals of XML and the H for a split to happen.
  • parseHTTPResponse becomes parseHttpresponse and APIKey becomes apikey, for the same reason.

If your style guide keeps acronyms in capitals, as in userID, or wants apiKey, type a space between the acronym and the next word before converting, or fix the result by hand.

Making sure the result is a valid identifier

Only spaces, hyphens and underscores are removed. Other characters stay where they are, and many of them aren't allowed in a variable name:

  • order total ($) becomes orderTotal($).
  • Is Active? becomes isActive?.
  • it's done becomes it'sDone.
  • user.email stays user.email, since a dot doesn't separate words.

Numbers also need a look. page 2 title gives page2Title, which is fine, but 10 Tips for SEO gives 10TipsForSeo, and JavaScript, Java and most other languages don't allow a name to start with a digit. Remove punctuation from your input first, and rename anything that starts with a number.

One name per run

Line breaks count as word separators, so a pasted list becomes one long name: first name and last name on two lines give firstNameLastName. To convert a list of field names, convert them one at a time. Accented letters are kept, so Über Cool Größe gives überCoolGröße. JavaScript accepts that, but most codebases stick to unaccented letters.

Frequently asked questions

What is the difference between camelCase and PascalCase?+

camelCase starts with a lowercase letter, as in userFirstName, and is the usual style for variables, functions and JSON keys in JavaScript and Java. PascalCase capitalises the first word too, as in UserFirstName, and is typically used for class and component names.

Can I convert camelCase back into words?+

Not with this tool, but the snake_case and kebab-case converters split camelCase at each capital. Converting getUserById to kebab-case gives get-user-by-id, and you can then replace the hyphens with spaces in Find and Replace.

Why did version2Beta become version2beta?+

A split only happens where a lowercase letter meets a capital. A digit followed by a capital doesn't count, so 2Beta stays one word and is lowercased. Put a space before Beta if you want version2Beta.

Embed this tool on your website

Free to use on blogs, school sites and intranets. Paste this code into your page's HTML; please keep the credit line.

<iframe src="https://utilityapp.lat/embed/text/camelcase-converter" title="camelCase Converter" width="100%" height="600" style="border:0;max-width:760px" loading="lazy"></iframe>
<p style="font-size:13px"><a href="https://utilityapp.lat/text/camelcase-converter">camelCase Converter</a> by UtilityApp</p>