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.
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.
Ready to try it?
Use our free Case Converter to apply these rules instantly — no signup required.
Open Case Converter →Related articles
What Is Title Case? Rules, Examples, and Style Guides
Title case capitalizes principal words in headings. Learn the rules, see examples, and how APA, Chicago, AP, and MLA styles differ.
What Does Sentence Case Mean? Rules and Examples
Sentence case capitalizes only the first word and proper nouns. Learn when to use it, how it differs from title case, and where each is standard.
APA Title Case Rules: Complete Guide for 2026
APA 7th Edition title case lowercases all prepositions regardless of length. Complete rules, examples, and comparison with Chicago, AP, and MLA styles.
Chicago Style Title Case Rules Explained
Chicago Manual of Style title case capitalizes prepositions of 5+ letters but lowercases shorter ones. Complete CMOS 17 rules with examples.