PascalCase Converter (Live UpperCamelCase & Component Tool)

Convert raw text, snake_case, kebab-case, and camelCase into clean PascalCase (UpperCamelCase). Format React and Vue component names, TypeScript classes, and C# type definitions with smart acronym detection and JSON key formatting.

What is PascalCase?

PascalCase (also known as UpperCamelCase) is a programming naming convention where words are joined without spaces, and the first letter of each word—including the initial word—is capitalized (e.g., UserProfileCard). It is the standard naming requirement for React components, TypeScript classes, and C# types.

5 lines
UpperCamelCase

Where PascalCase is Mandatory in Modern Software Stacks

While some naming conventions are aesthetic preferences, PascalCase is syntactically enforced across modern frameworks:

  • React & JSX Components: The JSX compiler treats lowercase tags (like <usercard />) as native HTML DOM elements. Custom components must start with a capital letter (<UserCard />) for React to recognize them as component instantiations.
  • TypeScript Classes & Interfaces: Standard TypeScript style guides dictate PascalCase for classes, type aliases, interfaces, and enums:
    class CustomerAccount implements AccountProfile { ... }
  • C# & .NET Standards: Microsoft's official .NET Framework Design Guidelines mandate PascalCase for all public class names, namespace identifiers, and method declarations (e.g., public void CalculateTotal()).
  • Python Classes (PEP 8): Python's official style guide enforces the CapWords convention for class declarations (e.g., class OrderManager:).

Programming Naming Conventions Comparison Matrix

Convention Capitalization Rule Example Syntax Primary Ecosystem
PascalCase (UpperCamelCase) First letter of EVERY word is capitalized UserProfileCard React, TypeScript, C#, Python Classes
camelCase (LowerCamelCase) First letter lowercase, subsequent words capitalized userProfileCard JavaScript variables, JSON keys, functions
snake_case All lowercase, words joined by underscores user_profile_card Python variables, SQL database columns
kebab-case All lowercase, words joined by hyphens user-profile-card CSS classes, URL permalink slugs, custom HTML elements

Programmatic PascalCase in JavaScript and Python

To convert strings to PascalCase programmatically inside your build pipelines:

JavaScript:

function toPascalCase(str) {
  return str
    .replace(/[-_\s]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''))
    .replace(/^(.)/, c => c.toUpperCase());
}

console.log(toPascalCase('user_profile_card')); // "UserProfileCard"

Python:

import re

def to_pascal_case(text):
    return ''.join(word.capitalize() for word in re.split(r'[-_\s]+', text) if word)

print(to_pascal_case('user-profile-card')) # "UserProfileCard"

Related Developer Case Converters:

Frequently Asked Questions

What is the difference between PascalCase and camelCase?

Both conventions capitalize each word without spaces. However, PascalCase capitalizes the first letter of the entire string (e.g., UserProfile), while camelCase starts with a lowercase letter (e.g., userProfile).

Why must React components be named in PascalCase?

The JSX compiler differentiates between native HTML DOM tags and custom React components based on capitalization. If a component starts with a lowercase letter (<userCard />), React attempts to render it as a built-in HTML tag, triggering runtime errors.

Why is it called PascalCase?

The convention was popularized by the Pascal programming language and Turbo Pascal, which standardized capitalizing the first letter of compound identifier names.

Does this tool preserve leading underscores for private classes?

Yes. When the "Preserve Leading/Trailing Underscores" option is enabled, identifiers like _internal_service convert cleanly to _InternalService without stripping the private scope indicator.

Can I convert JSON object keys to PascalCase for C# DTOs?

Yes. Enable the "JSON Keys Only Mode" checkbox and paste your raw JSON. The tool recursively transforms all object keys into PascalCase while preserving string values, numbers, and booleans.