Camel Case Converter
Paste words, phrases or existing identifiers, one per line, and each line becomes a camelCase name such as userFirstName. Switch the style to PascalCase for class and type names.
0 words 0 characters 0 lines
Continue with this text: snake_casekebab-caseSlug
Your text stays in your browser: nothing is uploaded or stored on a server.
How to use the camel case converter
- Type or paste your text into Your text, one name per line. Click Example to load four sample lines.
- Under Style, keep camelCase for variables and functions, or choose PascalCase for classes, types and components.
- The Result box updates as you type. Click Copy or Download .txt.
- To turn the result into another format, use the links under the tool to send it on to snake_case, kebab-case or a URL slug.
The example input shows the common starting points, all converted with the real code:
| Before | camelCase | PascalCase |
|---|---|---|
user first name |
userFirstName |
UserFirstName |
get HTTP response code |
getHttpResponseCode |
GetHttpResponseCode |
Is-Valid email address |
isValidEmailAddress |
IsValidEmailAddress |
total_order_count |
totalOrderCount |
TotalOrderCount |
How the converter splits words
Every conversion first breaks each line into words, then rebuilds it. The rules:
- Separators. Anything that is not a letter or a digit separates words: spaces, tabs, underscores, hyphens, dots, slashes, commas, brackets,
@and so on. The separators themselves are dropped, sopath/to/filebecomespathToFileandorder total (USD)becomesorderTotalUsd. - Existing capitals. A lowercase letter or digit followed by a capital starts a new word (
parseHTMLsplits into parse and HTML). In a run of capitals, the last capital before a lowercase letter starts a new word, soXMLHttpRequestsplits into XML, Http and Request. Two exceptions keep common technical terms whole: a capital plus one lowercase letter followed by a digit is not split (IPv6), and a single lowercase letter followed only by capitals is one word (iOS,mRNA). - Case. Each word is lowercased, then the first letter of every word except the first is capitalized. In PascalCase the first word is capitalized as well. Acronyms are treated as ordinary words.
- Lines. Each line is converted separately and empty lines are kept. Spaces at the start and end of a line disappear, and Windows line endings become plain line breaks.
| Before | camelCase |
|---|---|
XMLHttpRequest |
xmlHttpRequest |
HTTPServer |
httpServer |
userID |
userId |
FirstName |
firstName |
MAX_RETRY_COUNT |
maxRetryCount |
[email protected] |
userExampleCom |
Because existing capitals mark word boundaries, the tool works in both directions: FirstName and first_name both give firstName, and you can paste camelCase back in to switch it to PascalCase.
Numbers, accents, apostrophes and emoji
- Digits stay attached to the letters they touch:
base64 encodebecomesbase64Encode,page-2-titlebecomespage2Titleanditem2Pricestaysitem2Price. A number standing alone joins the next word directly, soversion 2 0becomesversion20. A letter right after a leading digit is never capitalized, in either style:3d modelgives3dModeland2fast 2furiousgives2fast2furious. Most languages do not allow a name to start with a digit, so add a letter in front if you need a valid identifier. - Accented letters count as letters and are kept:
café au laitbecomescaféAuLait. Many languages and databases only accept ASCII names, so run the text through remove accents first if you needcafeAuLait. - Apostrophes inside a word (straight
'or curly’) are removed before splitting, as the Google Java Style Guide recommends:don't stopgivesdontStopandCustomer's namegivescustomersName. - Emoji and symbols are removed:
😀 smile facebecomessmileFace. - Chinese and Japanese text is kept as it is, without spaces, because these scripts have no upper and lower case.
- Mixed-case brand names are handled by the splitting rules above.
iOS appbecomesiosAppandsupports IPv6 on iOS?becomessupportsIpv6OnIos, the Google Java Style Guide’s own example. Words such asiPhoneandeBaystill split at their capital, because identifiers likexAxishave the same shape:iPhone 15 ProbecomesiPhone15Proin camelCase andIPhone15Proin PascalCase, andeBaystayseBay. Check names like these by hand.
When people need it
- Turning spreadsheet headers into field names. Paste a column of headers such as Order ID, Shipping address line 1 and Customer email, one per line, and you get
orderId,shippingAddressLine1andcustomerEmailfor a JSON payload or a TypeScript interface. A header row copied as one line with commas becomes a single long name, so put each header on its own line first. The text splitter can do that. - Moving data between back end and front end. APIs written in Python or SQL often return
snake_casekeys (created_at,is_active), while JavaScript code usually expectscreatedAtandisActive. - Naming React or Vue components and classes. Switch to PascalCase to turn user profile card into
UserProfileCard. - Renaming CSS or config keys. A custom property such as
--main-bg-colorbecomesmainBgColorfor use in a JavaScript style object.
Order ID
shipping-address line 1
CUSTOMER_EMAIL
billing zip code
becomes
orderId
shippingAddressLine1
customerEmail
billingZipCode
camelCase, PascalCase and snake_case: which to use
The name comes from the capital letters in the middle of a word, which look like a camel’s humps. MDN calls camel case the most popular convention in JavaScript and Java. In practice, each language’s style guide decides:
| Language or guide | Variables and functions | Classes and types | Constants |
|---|---|---|---|
| Java (Google Java Style Guide) | lowerCamelCase |
UpperCamelCase |
UPPER_SNAKE_CASE |
| JavaScript (MDN examples) | encodeURIComponent |
ArrayBuffer |
varies by project |
| Python (PEP 8) | snake_case |
CapWords (PascalCase) |
UPPER_CASE_WITH_UNDERSCORES |
Acronyms are where the guides disagree. The Google Java Style Guide lowercases everything before capitalizing, so “XML HTTP request” becomes XmlHttpRequest and “new customer ID” becomes newCustomerId. This converter follows that rule and gives the same two results. PEP 8 asks for the opposite in class names: HTTPServerError, not HttpServerError. The browser’s own XMLHttpRequest mixes both styles. If your codebase keeps acronyms in capitals, convert first and then restore the acronyms by hand.
For a longer comparison with kebab-case and when each one fits, read camelCase vs snake_case vs kebab-case.
Questions
What is camel case?
Camel case writes a phrase without spaces and marks each new word with a capital letter, as in firstName or getUserById. In lower camel case (camelCase) the first word starts lowercase; in upper camel case, also called Pascal case, it starts with a capital (FirstName).
What is the difference between camel case and snake case?
Camel case joins words with capital letters (orderTotal); snake case keeps every word lowercase and joins them with underscores (order_total). JavaScript and Java usually use camel case for variables and functions, while Python's PEP 8 asks for snake case. The snake case converter turns either form into the other.
How does the converter handle acronyms such as HTTP or ID?
It lowercases them like any other word, so "get HTTP response code" becomes getHttpResponseCode and "new customer ID" becomes newCustomerId. That matches the Google Java Style Guide. If your project keeps acronyms in capitals (getHTTPResponseCode), fix those by hand after converting.
Can I convert a whole list of names at once?
Yes. Every line is converted on its own, so a column of 200 field names pasted from a spreadsheet comes back as 200 camelCase names in the same order. Empty lines stay empty.
Does it convert snake_case and kebab-case to camelCase?
Yes. Underscores, hyphens, dots, slashes and spaces all separate words, so user_id, user-id and user.id all become userId. CONSTANT_CASE works too - MAX_RETRY_COUNT becomes maxRetryCount.
Is camel case the same in Python, Java and JavaScript?
The format is the same; where it is used differs. In Python, PEP 8 uses CapWords (PascalCase) for classes and snake_case for functions and variables. Java and JavaScript use lowerCamelCase for methods and variables and UpperCamelCase for classes.
Is my text uploaded anywhere?
No. The conversion runs in your browser as you type, and nothing is sent to a server.