What Is camelCase? Uses, Rules, and Examples | TitleCasePro
camelCase joins words without spaces, capitalizing each word after the first. It is the standard naming convention in JavaScript, TypeScript, and Java.
Quick answer: camelCase joins words with no spaces and capitalizes the first letter of every word except the first — like
firstNameorgetUserProfile. It is the standard for variables and functions in JavaScript, TypeScript, and Java.
camelCase is a naming convention where multiple words are combined into a single identifier without spaces, and each word after the first begins with a capital letter. The name comes from the visual appearance — the capital letters look like the humps of a camel.
Examples:
firstNamebackgroundColorgetUserProfileisLoggedInmaxRetryCount
Key rule: The first word is entirely lowercase in camelCase. This is what distinguishes it from PascalCase (UpperCamelCase), where the first letter is also capitalized:
FirstName,BackgroundColor.
Where camelCase Is Used
JavaScript and TypeScript
camelCase is the de facto standard for variable names, function names, and object properties in JavaScript and TypeScript:
const userName = 'Alice';
function getUserById(id) {}
const response = { "firstName": "Alice", "lastName": "Smith" };
Java
int numberOfStudents = 0;
public void calculateTotal() {}
private String emailAddress;
Go
Unexported (private) identifiers use camelCase; exported (public) identifiers use PascalCase:
func parseConfig() {} // unexported: camelCase
func ParseConfig() {} // exported: PascalCase
Swift and Kotlin
Variables and functions follow camelCase; types and classes use PascalCase.
CSS custom properties vs. JavaScript
CSS uses kebab-case for custom properties (--background-color), but JavaScript uses camelCase for the same values (backgroundColor in React inline styles). This is a common source of confusion when moving between CSS and JS.
camelCase vs. PascalCase
The only difference is the first letter:
| Convention | First letter | Example |
|---|---|---|
| camelCase | lowercase | firstName |
| PascalCase | Uppercase | FirstName |
In most languages: camelCase → variables and functions. PascalCase → classes, types, components.
class UserProfile { // PascalCase: class
constructor(firstName) { // camelCase: parameter
this.firstName = firstName;
}
getDisplayName() { // camelCase: method
return this.firstName;
}
}
camelCase vs. snake_case
snake_case uses underscores to separate words with all letters lowercase. It is common in Python, Ruby, and database naming.
| Convention | Separator | Example | Primary use |
|---|---|---|---|
camelCase | none (capital) | firstName | JavaScript, Java, Swift |
snake_case | underscore | first_name | Python, Ruby, databases |
PascalCase | none (capital) | FirstName | Classes, React components |
kebab-case | hyphen | first-name | URLs, CSS classes |
⚠️ Common mismatch: Python APIs often return
first_name(snake_case), while JavaScript expectsfirstName(camelCase). Most serialization libraries handle this conversion automatically, but you need to be aware of which convention each layer uses.
Rules for Writing camelCase
- No spaces or special characters — words are joined directly.
- First word is entirely lowercase —
userProfile, notUserProfile. - Each subsequent word starts with a capital letter —
firstName,getBackgroundColor. - Abbreviations and acronyms — modern style guides (Airbnb, Google) treat abbreviations as words:
- ✅
userId,htmlParser,apiKey - ❌
userID,HTMLParser,APIKey(older style, avoid in new code)
- ✅
Converting to camelCase
The case converter converts any phrase to camelCase instantly. Paste “get user profile” or “background color” and it generates getUserProfile and backgroundColor — plus all other formats (PascalCase, snake_case, kebab-case, CONSTANT_CASE) simultaneously.
Developer Naming Conventions
Ready to try it?
Use our free Case Converter to apply these rules instantly — no signup required.
Open Case Converter →Related articles
How Long Does It Take to Read and Speak Text? (WPM Reference)
Reading time and speaking time are calculated from word count. Here are the exact formulas, average WPM rates by context, and a comparison table for common content lengths.
How to Clean Up Messy Text — Remove Line Breaks, Spaces, and Duplicates
A practical guide to fixing common text formatting problems: extra line breaks from PDFs, double spaces, blank lines, and duplicate entries. Includes one-click fixes.
How to Extract Email Addresses From Text (Any Format)
Learn how to extract email addresses from plain text, HTML, CSV files, and logs instantly — and which patterns count as valid emails.
How to Extract URLs From Text — Links, Hrefs, and Bare Domains
How to pull all URLs and links out of any text — HTML source, Markdown, log files, or plain prose — and get a clean deduplicated list.