PascalCase Converter

Convert phrases and other naming styles to PascalCase, with a capital on every word and no spaces. For class names, types and React components.

PascalCase capitalises the first letter of every word and removes the gaps: UserAccount, OrderItem, HttpClient. It is camelCase with a capital at the start. The name comes from the Pascal programming language, where the style was popular, and it is also called UpperCamelCase.

Most languages use it for the names of types: classes in Java, C# and TypeScript, structs in Rust and Go, interfaces and enums nearly everywhere. If you write React or Vue, components are named this way too, and the file that holds a component typically matches, UserCard.tsx.

Using the tool

Put one name per line. The input can be anything: a plain phrase such as “order line item”, a snake_case column name like order_line_item, a kebab-case slug, or text already in camelCase. All become OrderLineItem. Each line is treated separately, so a list converts in one step.

Every word has its first letter capitalised and the rest lowercased. That matters for acronyms. An input like HTTP client becomes HttpClient, not HTTPClient. Recent style guides recommend exactly that: treat an acronym like any other word so the humps remain readable, particularly when two acronyms collide, as in XmlHttpRequest rather than XMLHTTPRequest. Some projects still want fully capitalised acronyms, in which case you will retype them.

One gotcha

As with the other naming tools, word breaks are found at separators and at the point where a lowercase letter or number is followed by a capital. A string already in capitals, like USERNAME, has no inner boundary and is read as a single word, giving Username. A string like MyHTMLParser gives MyHtmlparser, because the block of capitals HTMLP is read as one word. Type those as spaced words for the right result.

Choosing between the styles

Use PascalCase for names of things (types and components), camelCase for variables and functions, snake_case in Python and databases, kebab-case in URLs and CSS, and CONSTANT_CASE for constants. Following the norm of the language you are in matters more than any private preference, since linters check for it and teammates read it.

If you need to review a name in several styles, the case converter shows eleven at once. Other text jobs that come up around code naming include removing special characters from a phrase before converting it.

Why the capital letter matters in components

In React’s JSX, the capital is not just style. A tag that starts with a lowercase letter, such as <button>, is treated as a built-in HTML element, while <Button> is treated as your own component, so a component named userCard will not render the way you expect. C# and many other languages use PascalCase for public methods, properties and types, and keep camelCase for private fields and local variables, which lets you tell at a glance whether a name belongs to the outside world. File names usually match the type: UserCard.tsx holds UserCard.

Frequently asked questions

What is the difference between PascalCase and camelCase?

PascalCase starts with a capital letter, as in UserAccount. camelCase starts with a lowercase letter, as in userAccount. Both capitalise each following word.

Should an acronym stay in capitals in PascalCase?

Many style guides, including Google's Java style and Microsoft's guidelines for acronyms longer than two letters, suggest treating them as normal words: HttpClient, XmlParser. This tool does that. Use find and replace if your project prefers fully capitalised acronyms.

Why did MyHTMLParser turn into MyHtmlparser?

The capitals HTMLParser form one unbroken block, so they are read as a single word. Enter it as "my html parser" to get MyHtmlParser.