Menu

Pascal Case Converter

Paste one name per line and get it in PascalCase, every word capitalized and joined with no spaces, such as UserAccountService. Switch the style to camelCase for a lowercase first word.

0 words 0 characters 0 lines

Style

Continue with this text: camelCasesnake_casekebab-case

Your text stays in your browser: nothing is uploaded or stored on a server.

How to use the Pascal case converter

  1. Type or paste your text into Your text, one name per line. Click Example to load four sample names, or Open file to read a .txt or .csv file.
  2. Leave Style on PascalCase, or choose camelCase if the first word should start lowercase.
  3. The Result box updates as you type. Click Copy, Download .txt, or Use as input to keep working on the result.
  4. To turn the same names into another case, use the links under the result for camelCase, snake_case or kebab-case.

What the converter does to your text

The converter works line by line, so each line becomes one identifier. On every line it:

  1. Splits the line into words. Apostrophes inside a word (’ and ’) are removed first, so don't stays one word. Any run of characters that is not a letter or a digit is a word boundary: spaces, tabs, underscores, hyphens, dots, slashes, brackets, colons, question marks and emoji. A change from a lowercase letter or digit to a capital also starts a new word, so names that are already in camelCase or PascalCase are split correctly. In a run of capitals, the last capital before a lowercase letter starts the next word, so JSONData splits into JSON and Data. Two exceptions keep common names whole: a capital followed by a lowercase letter and a digit stays with the capitals before it (IPv6 is one word), and a single lowercase letter followed only by capitals is one word (iOS, mRNA).
  2. Lowercases each word and capitalizes its first character if that character is a letter; a word that starts with a digit keeps its letters lowercase (2nd). In camelCase mode the first word stays all lowercase.
  3. Joins the words with nothing in between and drops all spaces and punctuation, including spaces at the start and end of the line.

The Example button converts this list:

user account service
http request handler
order-line item
shopping_cart_total

into:

UserAccountService
HttpRequestHandler
OrderLineItem
ShoppingCartTotal

With camelCase selected, the same input gives userAccountService, httpRequestHandler, orderLineItem and shoppingCartTotal.

Worked examples and edge cases

Before PascalCase camelCase
first-name last_name FirstNameLastName firstNameLastName
HTTP_STATUS_CODE HttpStatusCode httpStatusCode
XMLHttpRequest XmlHttpRequest xmlHttpRequest
getUserID GetUserId getUserId
user.profile.email UserProfileEmail userProfileEmail
total (USD) TotalUsd totalUsd
api v2 client ApiV2Client apiV2Client
covid-19 cases Covid19Cases covid19Cases
café crème CaféCrème caféCrème
user's name UsersName usersName
supports IPv6 on iOS? SupportsIpv6OnIos supportsIpv6OnIos
2nd place 2ndPlace 2ndPlace

Points worth knowing before you paste the result into code:

  • Acronyms lose their capitals. HTTP, XML and ID become Http, Xml and Id. Brand names written with inner capitals are split at the capital: YouTube importer becomes YouTubeImporter.
  • Digits stay attached to the word they follow or start: html5 parser becomes Html5Parser, and a letter right after a leading digit stays lowercase (3d model becomes 3dModel). A line that starts with a digit gives a name that starts with a digit, which most programming languages do not accept as an identifier, so add a word in front.
  • Apostrophes are dropped, not treated as breaks. user's name becomes UsersName and don't stop becomes DontStop, following step 1 of the Google Java Style camel case procedure (“remove any apostrophes”). To use another character, such as an underscore, change apostrophes first with find and replace.
  • Accented letters are kept, so café stays Café. Many languages allow them in identifiers, but if your project uses ASCII names only, run the text through remove accents first.
  • Lines with no letters or digits become empty, and empty lines stay empty, so the output has the same number of lines as the input.
  • Chinese and Japanese text has no capitals: spaces are removed and the characters are joined unchanged.

How acronyms are written in different style guides

Style guides disagree about acronyms, and that is the part of a PascalCase name most often written “wrong” for a given codebase:

Convention Example from the guide Matches this tool?
.NET Framework Design Guidelines HtmlTag, but IOStream for two-letter acronyms Yes for three letters or more; two-letter acronyms become Io
Google Java Style Guide XmlHttpRequest, newCustomerId Yes
Python PEP 8 (class names) HTTPServerError is better than HttpServerError No: capitalize the acronym by hand
Go (Effective Go) MixedCaps rather than underscores Yes for the joining; Effective Go sets no acronym rule, so follow your project

Microsoft’s guidelines also treat closed compound words as one word: Endpoint, Callback and Metadata, not EndPoint or MetaData. The converter cannot know that end point should be one word, so write closed compounds as one word in your input.

Where PascalCase is used

  • Class and type names in C# and .NET, Java (where Google’s guide calls it UpperCamelCase) and Python. The .NET guidelines go further and use PascalCase for namespaces, methods, properties, events, public fields and enum values; camelCase is kept for parameter names.
  • Exported names in Go. In Go, a name that starts with a capital letter is visible outside its package, so ParseConfig is public and parseConfig is not. Changing the case changes the meaning.
  • React components, such as UserProfileCard. React’s documentation says component names must start with a capital letter, which is how React tells <Profile /> apart from an HTML tag such as <section>.
  • Turning a spreadsheet header row into model names. Paste the column names one per line (Order ID, Customer name, Ship date) to get OrderId, CustomerName and ShipDate.
  • Renaming a list of database tables or API fields from snake_case or kebab-case to the names a C# or Java class expects.

PascalCase, camelCase, snake_case and kebab-case

All four join the words of a name without spaces; they differ in how the word boundaries are marked. PascalCase and camelCase use capital letters and differ only in the first letter. snake_case uses underscores and lowercase letters, common for Python functions and database columns, and kebab-case uses hyphens, common in URLs and CSS class names. The guide camelCase vs snake_case vs kebab-case explains which languages and tools expect which style. To see every case of the same text side by side, use the case converter.

Questions

What is Pascal case?

Pascal case (PascalCase) writes a name with no spaces and a capital letter at the start of every word, including the first, for example OrderLineItem. It is also called upper camel case, and Python's PEP 8 calls it CapWords.

What is the difference between Pascal case and camel case?

Only the first letter. PascalCase starts with a capital (UserAccount) and camelCase starts lowercase (userAccount). Pick the style with the Style option; the camel case converter does the same job with camelCase as the default.

What is the difference between Pascal case and snake case?

PascalCase marks word boundaries with capital letters and no separator (ShoppingCartTotal); snake_case writes every word in lowercase and joins them with underscores (shopping_cart_total). The snake case converter converts in the other direction.

Can I convert many names at once?

Yes. Each line is converted on its own, so a list of 500 column names gives 500 PascalCase names in the same order. Empty lines are kept.

Why did HTTP become Http?

The converter lowercases every word before capitalizing its first letter, so HTTP request becomes HttpRequest. That matches the .NET and Google Java conventions for acronyms of three letters or more. If your project writes acronyms in capitals, as PEP 8 recommends for Python class names, fix those letters by hand.

Is my text sent anywhere?

No. The conversion runs in your browser and nothing is uploaded or stored on a server.