PascalCase vs camelCase | Case Modify
Learn when to use PascalCase versus camelCase in JavaScript, TypeScript, C#, and API design—with examples and common mistakes.
The one-letter rule
camelCase starts lowercase: userProfileId. PascalCase starts uppercase: UserProfileId. That single difference maps to variables versus types in most modern codebases.
JavaScript and TypeScript
Variables, functions, and object properties → camelCase. Classes, React components, and type aliases → PascalCase. Linters enforce this split so imports read predictably.
JSON and APIs
Many REST APIs document camelCase field names even when databases use snake_case. Document the mapping at the boundary so mobile and web clients do not guess.
Common mistakes
Naming React components in camelCase. Exporting PascalCase JSON keys to JavaScript clients without transformation. Using PascalCase for environment variables — use CONSTANT_CASE instead.
Related resources: camelCase Converter • PascalCase Converter • What is camelCase? • What is PascalCase?
Frequently asked questions
Should file names match PascalCase components?
Most React teams name files after the component (UserCard.tsx). Consistency helps search and imports.
Which do Python developers use?
Python prefers snake_case for variables and functions. PascalCase appears on class names, similar to TypeScript.