TC
ProgrammingJanuary 18, 2025·4 min read

What is PascalCase? A Complete Explanation with Examples

What is PascalCase?

PascalCase (also called UpperCamelCase) is a naming convention where the first letter of every word is capitalized, with no spaces or separators between words.

Examples: MyClass, UserProfile, GetUserById, BackgroundColor

The name comes from the Pascal programming language, which popularized this style.


PascalCase in Programming

PascalCase is the standard convention for class names across virtually all object-oriented languages:

LanguageWhat Uses PascalCase

|---|---|

JavaClass names, interfaces, enums (`UserService`, `HttpClient`)
C#Classes, methods, properties, enums, namespaces
TypeScriptInterfaces, type aliases, enums (`UserProfile`, `ApiResponse`)
PythonClass names per PEP 8 (`MyClass`, `DatabaseConnection`)
ReactComponent names (`Button`, `UserCard`, `NavBar`)
SwiftClass names, structs, enums, protocols

PascalCase vs camelCase

FeaturePascalCasecamelCase

|---|---|---|

First letter**Uppercase**Lowercase
Example`UserProfile``userProfile`
Used forClasses, types, componentsVariables, functions, methods
Also known asUpperCamelCaselowerCamelCase

Rule of thumb: In most languages, types use PascalCase; values use camelCase.


PascalCase in React

React has a very specific rule: all component names must use PascalCase.

This is not just a convention — it's enforced by React's rendering engine. A component named button would be treated as an HTML element. A component named Button is treated as a React component.

`

— PascalCase — rendered as React component

— lowercase — rendered as HTML (won't work)

`


Best Practices

  • Use PascalCase for all class names, even in languages that don't enforce it
  • Treat acronyms consistently — prefer XmlParser over XMLParser for readability
  • In React, always use PascalCase for component file names too — UserCard.tsx, not userCard.tsx