camelCase is a compound word writing convention where each constituent word begins with a capital letter without delimiter spaces, standard in JavaScript and modern software.
camelCase (specifically lowerCamelCase) is a naming convention for compound words and program identifiers where words are joined without spaces, hyphens, or underscores, and each word after the initial word begins with an uppercase letter (e.g., userAccountBalance, parseJsonPayload). The convention draws its name from the visual profile of uppercase letters resembling the humps of a camel.
In modern software development, choosing and adhering to standardized casing conventions is essential for codebase readability, automated serialization/deserialization across API boundaries (JSON to typed structs), and AST-based linting rules.
Transform strings and identifiers across 20+ case conventions in real time with our browser-based Text Case Converter, compare differences in refactored code with the Diff Viewer, or validate identifier patterns using the Regex Tester.
| Convention | Pattern Example | Primary Language Ecosystems & Standard Use Cases |
|---|---|---|
| camelCase | userProfileId |
JavaScript, TypeScript, Java, C#, Swift, Dart (variables, functions, methods) |
| PascalCase | UserProfileCard |
React/Vue components, TypeScript types/interfaces, C# classes, Go exported types |
| snake_case | user_profile_id |
Python (PEP 8), Rust, C, Ruby, SQL database column and table names |
| SCREAMING_SNAKE | MAX_RETRY_COUNT |
Environment variables, compile-time constants, C/C++ macros, Redux action types |
| kebab-case | user-profile-card |
URL slugs, CSS class names, HTML data attributes, npm packages, Kubernetes labels |
| Train-Case | Content-Type |
HTTP headers (RFC 9110), MIME message headers, multi-part form boundaries |
| dot.case | config.auth.token |
Java package hierarchies, nested configuration keys, JSONPath accessor paths |
┌───────────────┬──────────────────┬──────────────────┬──────────────────┬──────────────────┐
│ Language │ Variables/Methods│ Classes/Types │ Constants │ Modules/Packages │
├───────────────┼──────────────────┼──────────────────┼──────────────────┼──────────────────┤
│ TypeScript/JS │ camelCase │ PascalCase │ SCREAMING_SNAKE │ kebab-case / camel│
│ Python │ snake_case │ PascalCase │ SCREAMING_SNAKE │ snake_case │
│ Rust │ snake_case │ PascalCase │ SCREAMING_SNAKE │ snake_case │
│ Go │ camelCase / Pascal│ PascalCase │ PascalCase/SCREAM│ lower / flatcase │
│ C# │ camelCase │ PascalCase │ PascalCase/SCREAM│ PascalCase │
│ SQL / Postgres│ snake_case │ snake_case │ UPPERCASE │ snake_case │
└───────────────┴──────────────────┴──────────────────┴──────────────────┴──────────────────┘
A common pitfall in string transformation algorithms is incorrect handling of acronyms (such as XMLParser, getHTMLString, or JSON2CSV). A naive split on /[A-Z]/ fragments acronyms into single letters (["X", "M", "L", "Parser"]).
A robust tokenizer utilizes multi-pass regex lookaheads to identify word transitions:
export function tokenizeIdentifier(input: string): string[] {
// Step 1: Split between consecutive capitals and subsequent lowercase word (e.g. 'XMLParser' -> 'XML Parser')
let s = input.replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2');
// Step 2: Split between lowercase/digit and subsequent uppercase (e.g. 'getHTMLString' -> 'get HTML String')
s = s.replace(/([a-z\d])([A-Z])/g, '$1 $2');
// Step 3: Replace delimiters (_, -, ., /, \) with whitespace
s = s.replace(/[_\-./\\]+/g, ' ');
// Step 4: Tokenize into lowercase constituent tokens
return s
.split(/\s+/)
.map((token) => token.toLowerCase())
.filter(Boolean);
}
// Examples:
// 'getHTMLResponse' -> ['get', 'html', 'response']
// 'RESTfulAPI' -> ['restful', 'api']
// 'user_id_v2' -> ['user', 'id', 'v2']
When passing data across boundaries (for example, receiving snake_case JSON from a Python/PostgreSQL backend into a TypeScript frontend expecting camelCase), serialization libraries manage conversion via decorators or runtime mapping:
import { z } from 'zod';
const UserSchema = z
.object({
first_name: z.string(),
last_name: z.string(),
email_address: z.string().email(),
})
.transform((data) => ({
firstName: data.first_name,
lastName: data.last_name,
emailAddress: data.email_address,
}));
export type User = z.infer<typeof UserSchema>;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct UserProfile {
pub first_name: String, // Serializes as "firstName" in JSON
pub last_name: String, // Serializes as "lastName" in JSON
pub is_active_account: bool, // Serializes as "isActiveAccount" in JSON
}
Search engine web crawlers (such as Googlebot) treat hyphens (-) as word delimiters, allowing individual terms to be indexed separately. Underscores (_) in URLs are historically treated as word joiners, causing search engines to view user_profile as a single composite term userprofile.
Title Case adheres to style guidelines (such as AP or Chicago Manual of Style) where minor function words (e.g., a, an, the, and, but, or, in, of, to) remain lowercase unless positioned at the beginning or end of the title. Capital Words capitalizes every word without regard to grammatical function.
In Go, character casing at the beginning of an identifier controls its scope: an identifier starting with an uppercase letter (PascalCase, e.g., ExportedFunction) is public and exported outside its package, whereas an identifier starting with a lowercase letter (camelCase, e.g., internalHelper) is private to its package.
Free, browser-based utilities to test, generate, and inspect camelCase & Identifier Naming Conventions payloads directly.
Convert text between 20+ case formats: camelCase, snake_case, kebab-case, Title Case, and more.
Compare two text blocks and highlight exactly what changed.
Test, debug, and explain regular expressions with real-time match highlighting.
Convert JSON to C# classes with System.Text.Json or Newtonsoft serialization.
Convert JSON to TypeScript interfaces or type aliases instantly.