Text Case Converter

UPPERCASE

lowercase

Title Case

camelCase

snake_case

kebab-case

Text Case Conventions Explained: camelCase, PascalCase, snake_case, kebab-case, and More

Naming conventions are one of the most fundamental aspects of writing readable, maintainable code. The way you capitalize and separate words in identifiers — variable names, function names, class names, file names, URL slugs, CSS classes, and database columns — communicates meaning, follows language conventions, and directly impacts how quickly developers can understand and navigate a codebase. This tool converts any text between six common case formats instantly, helping you translate identifiers between languages, frameworks, and naming standards.

While the technical act of changing case is simple, understanding when and why to use each convention is essential for professional software development. Every major programming language, framework, and style guide has specific expectations about naming, and violating these expectations makes code look foreign to experienced developers in that ecosystem.

Complete Case Convention Reference

ConventionExampleSeparatorPrimary Uses
camelCasegetUserNameCapital lettersJS/Java/C# variables, functions, JSON keys
PascalCaseGetUserNameCapital lettersClasses, types, React components, C# methods
snake_caseget_user_nameUnderscoresPython, Ruby, Rust, SQL, file names
kebab-caseget-user-nameHyphensCSS classes, HTML attributes, URLs, CLI flags
UPPER_CASEGET_USER_NAMEUnderscoresConstants, env variables, macros
lowercasegetusernameNonePackage names (Java, Go), domains
UPPERCASEGETUSERNAMENoneSQL keywords, some acronyms
Title CaseGet User NameSpacesHeadings, UI labels, display text
Sentence caseGet user nameSpacesSentences, descriptions, alt text

camelCase: The JavaScript and Java Standard

camelCase (also called lower camelCase) starts with a lowercase letter and capitalizes the first letter of each subsequent word, with no separators between words. Examples: firstName, getElementById, calculateMonthlyPayment. The name comes from the "humps" created by the capital letters in the middle of the word, resembling a camel's back.

camelCase is the dominant convention for variables, functions, methods, and parameters in JavaScript, TypeScript, Java, Swift, Kotlin, and Dart. JSON property names conventionally use camelCase (matching JavaScript's native naming). If you work in web development, camelCase is the convention you will use most frequently — from DOM method names like addEventListener to React state variables and API response fields.

PascalCase: Classes, Components, and Types

PascalCase (also called upper camelCase) capitalizes the first letter of every word, including the first. Examples: UserAccount, HttpResponse, CalculatorWrapper. This convention is named after the Pascal programming language, which popularized it.

PascalCase is universally used for class names across virtually all object-oriented languages (Java, Python, C#, JavaScript, TypeScript, Ruby, Swift). In the JavaScript/React ecosystem, PascalCase distinguishes components from regular HTML elements — <UserProfile /> is a React component while <div> is a native element. TypeScript uses PascalCase for types, interfaces, and enums. C# uses PascalCase more broadly, including for public methods and properties, not just classes.

snake_case: Python, Ruby, Rust, and SQL

snake_case separates words with underscores and uses all lowercase letters. Examples: user_name, get_all_users, calculate_tax_amount. The name comes from the underscores "crawling" along the baseline of the text.

Python's PEP 8 style guide mandates snake_case for function names, method names, variable names, and module names. Ruby follows the same convention. Rust uses snake_case for function and variable names (the compiler will warn you if you deviate). SQL conventionally uses snake_case for table names and column names (user_accounts, created_at). Many database-heavy applications use snake_case throughout their stack to maintain consistency with the database schema.

kebab-case: CSS, URLs, and Command-Line Interfaces

kebab-case (also called dash-case or hyphen-case) separates words with hyphens and uses all lowercase letters. Examples: font-size, background-color, my-component. The name comes from the words being "skewered" on the hyphen, like food on a kebab stick.

CSS property names are exclusively kebab-case (margin-top, border-radius, z-index). BEM and other CSS methodologies use kebab-case for class names. URL slugs use kebab-case for SEO (search engines treat hyphens as word separators but not underscores). HTML custom attributes use kebab-case (data-user-id). Command-line flags use kebab-case with double-dash prefix (--output-dir, --no-cache). Note that kebab-case cannot be used as an identifier in most programming languages because the hyphen would be interpreted as the minus operator.

UPPER_CASE (SCREAMING_SNAKE_CASE): Constants and Environment Variables

UPPER_CASE (sometimes called SCREAMING_SNAKE_CASE or CONSTANT_CASE) uses uppercase letters with underscore separators. Examples: MAX_RETRY_COUNT, DATABASE_URL, API_BASE_URL. This convention is used universally for constants — values that are defined once and never changed. In JavaScript, const MAX_SIZE = 1024 uses UPPER_CASE to signal that this value is a true constant (not just a const binding that holds a mutable object). Environment variables follow this convention on all operating systems (PATH, HOME, NODE_ENV). C preprocessor macros and Java enums also use UPPER_CASE.

Naming Conventions by Programming Language

LanguageVariablesFunctionsClassesConstantsStyle Guide
JavaScriptcamelCasecamelCasePascalCaseUPPER_CASEAirbnb, Google
Pythonsnake_casesnake_casePascalCaseUPPER_CASEPEP 8
JavacamelCasecamelCasePascalCaseUPPER_CASEOracle Conventions
C#camelCasePascalCasePascalCasePascalCaseMicrosoft Guidelines
GocamelCasecamelCase/PascalCasePascalCasecamelCase/PascalCaseEffective Go
Rubysnake_casesnake_casePascalCaseUPPER_CASERuby Style Guide
Rustsnake_casesnake_casePascalCaseUPPER_CASERust API Guidelines
CSSkebab-caseN/Akebab-caseN/ABEM, SMACSS

When You Need to Convert Between Cases

Case conversion is not just a formatting exercise — it comes up regularly in real development workflows. API integration: A Python backend sends snake_case JSON keys (user_name) but your JavaScript frontend expects camelCase (userName). Libraries like lodash provide _.camelCase() and _.snakeCase() for this purpose. Database to code mapping: SQL column names use snake_case (created_at) but ORMs often map them to camelCase properties in the application layer. CSS-in-JS: CSS property names like background-color become camelCase backgroundColor when used in JavaScript style objects. URL slug generation: Article titles in Title Case need to be converted to kebab-case for SEO-friendly URLs.

Cross-language refactoring: When porting code between languages — say, converting a Python module to JavaScript — all snake_case identifiers need to become camelCase. Code generation: Tools that generate code from schemas (like OpenAPI/Swagger generators or GraphQL code generators) often need to convert between naming conventions to match the target language's style.

Title Case Rules and Edge Cases

Title Case capitalizes the first letter of each word, but true title case (as used in publishing) follows more nuanced rules. In AP, Chicago, and APA style, small words like "a", "an", "the", "and", "but", "or", "for", "in", "of", "on", "at", "to", and "with" are typically not capitalized unless they are the first or last word of the title. This converter capitalizes every word for simplicity, which matches the convention used in most programming contexts (UI labels, heading elements, menu items). For publishable prose, you would need a style-aware title case converter.

Handling Acronyms and Abbreviations

Acronyms in identifiers are a common source of inconsistency. Should you write getHTTPResponse or getHttpResponse? XMLParser or XmlParser? Style guides vary: Google's Java style guide treats acronyms as regular words (getHttpResponse), arguing it improves readability when multiple acronyms appear together. Apple's Swift API Design Guidelines also prefer utf8 over UTF8 for word boundaries. Microsoft's C# guidelines use PascalCase for two-letter acronyms (IO) but capitalize only the first letter for longer ones (Http). Pick a convention for your project and enforce it consistently.

How This Tool Works

This converter processes your text entirely in the browser using JavaScript string methods. It splits the input into words using whitespace boundaries, then applies the appropriate transformation for each case format. For camelCase, the first word is lowercased and subsequent words have their first letter capitalized. For snake_case and kebab-case, all words are lowercased and joined with underscores or hyphens respectively. Results update in real time as you type, and all processing happens locally — no data is sent to any server.

Frequently Asked Questions

What is the difference between camelCase and PascalCase?

camelCase starts with a lowercase letter and capitalizes the first letter of each subsequent word (e.g., firstName, getUserData). PascalCase capitalizes the first letter of every word, including the first (e.g., FirstName, GetUserData). In most languages, camelCase is used for variables and function names, while PascalCase is used for class names, type names, and React components. The distinction matters because it signals the role of the identifier — seeing PascalCase tells a JavaScript developer "this is a class or component," while camelCase signals "this is a variable or function."

When should I use snake_case vs kebab-case?

snake_case uses underscores between words and is the standard in Python (PEP 8), Ruby, Rust, and SQL (e.g., user_name, get_all_users). kebab-case uses hyphens and is standard for CSS class names and properties, HTML attributes, URL slugs, and CLI flags (e.g., font-size, my-component, --output-dir). The choice depends on the language and context: use snake_case in Python code and database column names, kebab-case in CSS and URLs. Note that kebab-case cannot be used as variable names in most programming languages because the hyphen is the minus operator.

What are the naming conventions for different programming languages?

JavaScript uses camelCase for variables/functions and PascalCase for classes/React components (Airbnb/Google style guides). Python uses snake_case for functions/variables and PascalCase for classes (PEP 8). Java uses camelCase for methods/variables and PascalCase for classes (Oracle Conventions). C# uses PascalCase for public methods and properties (Microsoft Guidelines). CSS uses kebab-case exclusively. SQL uses UPPER_CASE for keywords and snake_case for table/column names. Go uses camelCase for unexported and PascalCase for exported identifiers (Effective Go).

Does naming convention affect code quality?

Yes, significantly. Consistent naming conventions improve readability, reduce cognitive load, and make codebases easier to search and navigate. Studies have shown that snake_case identifiers are slightly easier to read for beginners, while experienced developers read both camelCase and snake_case at similar speeds. Most languages have official style guides that specify conventions, and linters (ESLint, Pylint, RuboCop, clippy) can enforce them automatically. Inconsistent naming is a common code review rejection reason and a signal of low code quality.

How should I handle acronyms in camelCase and PascalCase?

Style guides differ on acronym handling. Google's Java style guide and Apple's Swift API Design Guidelines treat acronyms as regular words (getHttpResponse, not getHTTPResponse), which improves readability when multiple acronyms appear together. Microsoft's C# guidelines capitalize two-letter acronyms fully (IO, DB) but only capitalize the first letter of longer ones (Http, Xml). The most common modern practice is to treat acronyms as words: httpResponse, xmlParser, apiKey. Pick one approach for your project and enforce it consistently with linting rules.

How do I convert between naming conventions in code automatically?

Most languages and frameworks provide utilities for programmatic case conversion. In JavaScript, lodash offers _.camelCase(), _.snakeCase(), _.kebabCase(), and _.startCase(). Python has the inflection library with camelize() and underscore() functions. Many ORMs automatically convert between snake_case database columns and camelCase application properties. For API integration, serialization libraries like Jackson (Java) and Pydantic (Python) support automatic case conversion between JSON and language conventions. IDE plugins can also batch-rename identifiers across entire codebases.

Related Developer Tools