TitleCasePro logo TitleCasePro

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.

· 4 min read · Try Case Converter →

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:

  • firstName
  • backgroundColor
  • getUserProfile
  • isLoggedIn
  • maxRetryCount

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:

ConventionFirst letterExample
camelCaselowercasefirstName
PascalCaseUppercaseFirstName

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.

ConventionSeparatorExamplePrimary use
camelCasenone (capital)firstNameJavaScript, Java, Swift
snake_caseunderscorefirst_namePython, Ruby, databases
PascalCasenone (capital)FirstNameClasses, React components
kebab-casehyphenfirst-nameURLs, CSS classes

⚠️ Common mismatch: Python APIs often return first_name (snake_case), while JavaScript expects firstName (camelCase). Most serialization libraries handle this conversion automatically, but you need to be aware of which convention each layer uses.

Rules for Writing camelCase

  1. No spaces or special characters — words are joined directly.
  2. First word is entirely lowercaseuserProfile, not UserProfile.
  3. Each subsequent word starts with a capital letterfirstName, getBackgroundColor.
  4. 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.

Related articles