What PascalCase is
PascalCase removes the spaces between words and gives every word a capital first letter:
user profile cardbecomesUserProfileCardorder_line_itembecomesOrderLineItemhttpClientbecomesHttpClient
It differs from camelCase in one way only: the first letter is a capital too.
How the converter works
For each line, the tool finds the words, capitalizes the first letter of each, lowercases the rest and joins them. It understands words separated by spaces, underscores, hyphens and dots, and it splits existing camelCase names at their capital letters. Apostrophes and punctuation are removed.
| Input | Output |
|---|---|
| user profile card | UserProfileCard |
| order_line_item | OrderLineItem |
| nav-bar-item | NavBarItem |
| getUserById | GetUserById |
| payment gateway response | PaymentGatewayResponse |
Where PascalCase is used
- Class names in Java, C#, Python, TypeScript, Swift, Kotlin and most other object-oriented languages
- React, Vue and Svelte components:
UserCard,NavBar - TypeScript types and interfaces:
UserProfile,ApiResponse - C#: method and property names as well as classes
- Go: exported functions and types, which must start with a capital to be visible outside their package
- Enum names in many languages
A useful rule of thumb in most languages: things you create instances of (classes, types, components) use PascalCase, and the instances themselves use camelCase or snake_case. So a UserProfile class produces a userProfile variable.
Typical conversions
Database tables to model classes. A table called order_line_items usually maps to a class called OrderLineItem. Paste your table names and convert the list, then drop the plural where needed.
File names to component names. A file called user-card.jsx usually exports a component called UserCard.
Plain descriptions to type names. Type “api error response” and get ApiErrorResponse.
Naming tips
- Use nouns for classes and types:
Invoice, notProcessInvoice. - Avoid abbreviations that only you understand.
CustomerAddressis clearer thanCustAddr. - Pick one acronym rule (
HttpClientorHTTPClient) and keep to it across the project.