Text Case Converter
Convert text between 12 standard cases: camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, Title Case, and more.
Universal Text Case Converter
JavaScript / TypeScript variables and object properties
React components, class definitions, and TypeScript interfaces
Python variables, PostgreSQL table columns, and JSON APIs
URL slugs, CSS class names, and package repositories
Environment variables, global constants, and enum keys
Book titles, editorial headlines, and document headings
UI button labels, error alerts, and prose sentences
HTTP response headers and MIME protocol fields
Kafka topics, translation keys, and log namespaces
Filesystem paths and URL route segments
All letters capitalized with whitespace preserved
All letters converted to standard lowercase
About
String casing and identifier naming conventions are foundational elements of software architecture, code maintainability, and multi-language interoperability. As software systems span heterogeneous environments—such as relational databases, REST and GraphQL APIs, frontend state trees, microservices, and infrastructure-as-code manifests—engineers frequently encounter mismatched capitalization paradigms that lead to serialization defects, impedance mismatches, and syntax violations.
The Taxonomy of Identifier Naming Conventions
Different programming languages and runtime ecosystems enforce specific identifier capitalization standards through compilers, linters, and community style guides:
- camelCase (Lower Camel Case): Standard in JavaScript (ECMA-262), TypeScript, Java, and Swift for variable and function declarations. Words are joined without delimiters, and every word after the initial word begins with an uppercase letter.
- PascalCase (Upper Camel Case): Standard for class, interface, component, and type declarations in C#, TypeScript/React, Go (exported package members), and Swift.
- snake_case: Universal standard in Python (PEP 8), Ruby, C, and SQL database relational column identifiers. Words are separated by single underscore (
_) characters and lowercased. - kebab-case (Lisp Case): Standard for HTML attributes, CSS class names, URL slugs (RFC 3986), and CLI flags. Words are separated by hyphens (
-). Note that kebab-case cannot be used as variable identifiers in most languages due to hyphen collision with the arithmetic subtraction operator. - CONSTANT_CASE (Screaming Snake Case): Standard for global immutable constants, environment variables (POSIX IEEE 1003.1), and C preprocessor macro definitions (
#define). - Title Case & Sentence Case: Standard in editorial copywriting, user interface typography, and Chicago Manual of Style (CMOS) heading formatting.
Identifier Convention Comparison Matrix
| Casing Style | Token Delimiter | Initial Character | Case Formatting | Canonical Ecosystems & Standards | Primary Use Cases |
|---|---|---|---|---|---|
| camelCase | None | Lowercase | Mixed (Subsequent words capitalized) | JavaScript (ECMA-262), Java, Swift | Local variables, object properties, functions |
| PascalCase | None | Uppercase | Upper Camel (Every word capitalized) | C#, Go (exported symbols), React JSX | Class names, TypeScript interfaces, components |
| snake_case | Underscore (_) |
Lowercase | All lowercase | Python (PEP 8), Rust, PostgreSQL | Python functions/variables, database columns |
| kebab-case | Hyphen (-) |
Lowercase | All lowercase | W3C CSS, URL Path Slugs (RFC 3986) | CSS selectors, REST URL endpoints, CLI flags |
| CONSTANT_CASE | Underscore (_) |
Uppercase | All uppercase | POSIX IEEE 1003.1, Docker, Linux Env | Environment variables, immutable global constants |
| Dot.Case | Period (.) |
Lowercase | All lowercase | Java package names, JSONPath keys | Configuration property hierarchies, metrics keys |
| Path/Case | Slash (/) |
Lowercase | All lowercase | POSIX File Systems, URL routes | File directory paths, dynamic route parameters |
Implementation Code Snippets Across Languages
TypeScript / Node.js (Robust Tokenizer with Acronym Preservation)
export function splitWords(input: string): string[] {
return input
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
.replace(/([A-Z])([A-Z][a-z])/g, '$1 $2')
.replace(/[\s_\-\.\/\]+/g, ' ')
.trim()
.split(/\s+/)
.filter(Boolean);
}
export function toCamelCase(str: string): string {
const words = splitWords(str);
return words
.map((word, index) =>
index === 0
? word.toLowerCase()
: word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
)
.join('');
}
Python 3 (PEP 8 Compliant Regex Converter)
import re
def to_snake_case(text: str) -> str:
s1 = re.sub(r'([a-z0-9])([A-Z])', r'\1_\2', text)
s2 = re.sub(r'([A-Z])([A-Z][a-z])', r'\1_\2', s1)
return re.sub(r'[\s\-\.\/\]+', '_', s2).lower().strip('_')
print(to_snake_case("userAccountId")) # "user_account_id"