Text Case Converter: camelCase, snake_case, PascalCase, kebab-case and More
Convert any text between camelCase, snake_case, PascalCase, kebab-case, UPPER_SNAKE, Title Case, and more. Essential for developers working across languages and style guides.
What Is the Text Case Converter?
A Text Case Converter transforms a piece of text between the naming conventions used in programming, writing, and design. Developers constantly switch between these formats when copying identifiers across languages, translating design tokens into code, or normalising user input for URLs and databases.
Different programming languages and style guides enforce different conventions. JavaScript and TypeScript prefer camelCase for variables (myVariableName) and PascalCase for class names (MyClassName). Python uses snake_case for functions and variables (my_function_name) and PascalCase for classes. CSS and HTML attributes use kebab-case (my-class-name). Database columns often use snake_case. Constants across many languages use UPPER_SNAKE_CASE (MAX_RETRY_COUNT).
Manually converting between these conventions is tedious and error-prone, especially when working with multi-word identifiers copied from documentation, design files, or APIs written in a different language's style. A single conversion tool eliminates the cognitive overhead of remembering the rules for each format while also preventing typos.
calc-masters's converter handles ten of the most common naming and writing conventions simultaneously, so you paste your text once and instantly see every format side by side. It intelligently splits input across spaces, underscores, hyphens, dots, and camelCase boundaries, so it correctly tokenises identifiers from any starting format.
Key Parameters & Input Variables
- Finite-State Automaton (FSA) Lexical Boundary Detection: Splits compound identifiers across Lower→Upper ([a-z][A-Z]), Acronym→Word ([A-Z]{2,}[A-Z][a-z]), Alpha↔Digit, and explicit separator boundaries.
- 18-Convention Simultaneous Synthesis: Generates camelCase, PascalCase, snake_case, SCREAMING_SNAKE_CASE, kebab-case, COBOL-CASE, Train-Case, dot.case, path/case, namespace::case, Ada_Case, Chicago/AP Title Case, Sentence case, UPPERCASE, lowercase, URL Slugs, aLtErNaTiNg cAsE, and InVeRsE CaSe.
- 5-Stylebook Editorial Title Case Engine: Contrasts Chicago Manual of Style (lowercases all prepositions like 'with', 'from', 'between') against AP and APA Style (capitalizes prepositions of 4+ letters).
- Recursive JSON Key & Multi-Stack Schema Generator: Converts nested JSON object keys between camelCase and snake_case and outputs ready-to-use TypeScript interfaces, PostgreSQL CREATE TABLE DDL, POSIX .env configs, and Python @dataclass definitions.
- ANSI X3.4 Bit-5 (0x20 = 32) Register & Keyword Collision Auditor: Inspects 8-bit binary registers showing how Bit 5 toggles ASCII case (c | 0x20 vs. c & ~0x20) and checks tokens against reserved keywords in JS/TS, Python, SQL, and Rust.
Common Use Cases & Applications
- Converting a Python snake_case variable name to camelCase for use in a JavaScript file.
- Transforming a design token name from Title Case into kebab-case for a CSS custom property.
- Converting a database column name from snake_case to camelCase for a JSON API response.
- Normalising user input into kebab-case for URL slugs and route parameters.
- Translating REST API field names into the local naming convention when integrating a third-party service.
- Converting English prose into Title Case for headings, or Sentence case for UI labels.
Mathematical Formula
The converter first tokenises the input by detecting word boundaries: spaces, underscores, hyphens, dots, and camelCase/PascalCase transitions (where a lowercase letter is followed by an uppercase letter). This tokenisation works regardless of the starting format, so 'myVariableName', 'my-variable-name', and 'my_variable_name' all produce the same three tokens: ['my', 'variable', 'name'].
Once the tokens are normalised, each target format reassembles them according to its rules. CamelCase lowercases all tokens and capitalises the first letter of each subsequent token. PascalCase capitalises the first letter of every token. Snake case joins tokens with underscores in lowercase. Kebab case joins with hyphens. The result is exact and consistent regardless of how convoluted the source formatting was.
Primary Governing Equation
lower(c) = c | 0x20; upper(c) = c & ~0x20; toggle(c) = c ⊕ 0x20; L(F_d) = ∑_{i=1}^k |t_i| + (k − 1)·|d|; Slug(s) = join_('-')(lower(NFD(s) \ [U+0300..U+036F]))
ANSI X3.4 Bit-5 (0x20 = 32) hardware case algebra, Finite-State Automaton (FSA) lexical boundary tokenization (t_1..t_k), delimiter length expansion L(F_d), and Unicode UAX #15 NFD diacritic folding.
camelCase
tokens[0].lower() + tokens[1..].map(capitalise).join('')
First word lowercase, subsequent words capitalised, no separator.
PascalCase
tokens.map(capitalise).join('')
Every word capitalised, no separator.
snake_case
tokens.map(lower).join('_')
All lowercase, underscore separator.
kebab-case
tokens.map(lower).join('-')
All lowercase, hyphen separator.
Step-by-Step Calculation Guide
- Step 1: Start with the identifier 'getUserProfileData'. The converter splits it at camelCase boundaries into four tokens: ['get', 'user', 'profile', 'data']. From there, every format is available instantly.
- Step 2: In Python, the same function would be get_user_profile_data (snake_case). As a CSS class it might be get-user-profile-data (kebab-case). As a constant it becomes GET_USER_PROFILE_DATA (UPPER_SNAKE). As a TypeScript class method in documentation it appears as getUserProfileData (camelCase).
- Step 3: All ten conversions appear at once, so if you are reviewing a codebase that mixes conventions, you can paste any identifier form and immediately see all equivalents — eliminating the manual back-and-forth of remembering each rule for each context.
Sensitivity Analysis & Edge-Case Behavior
Delimiter Length Expansion Law: Given k extracted lexical tokens of total alphanumeric length L_alpha, camelCase and PascalCase require exactly L_alpha bytes (0 delimiter overhead), snake_case and kebab-case require L_alpha + (k − 1) bytes, and C++/Rust namespace::case requires L_alpha + 2(k − 1) bytes.
Preposition Length Cutoff in Editorial Title Case: Prepositions of 4 or more letters ('with', 'from', 'into', 'between', 'through', 'under', 'without') are lowercased in Chicago (CMOS 17th) and MLA (9th), but capitalized in AP Stylebook and APA (7th), frequently altering 15% to 25% of words in technical headlines.
Common Pitfalls & Errors to Avoid
- Using naive single-pass regexes like s.replace(/([A-Z])/g, '_$1') on acronyms, which corrupts 'parseXMLHttpRequest' into 'parse_x_m_l_http_request'.
- Capitalizing short prepositions and articles ('Of', 'In', 'To', 'For', 'The') in editorial headlines when AP or Chicago Title Case is required.
- Assuming filesystem paths are case-insensitive: renaming a file from 'userProfile.ts' to 'UserProfile.ts' on macOS or Windows can break Linux CI/CD builds if Git case-sensitivity is not tracked.
Institutional & Industry Applications
Full-Stack API & Database Engineering: Bridging camelCase TypeScript/React frontends with snake_case Python/FastAPI, Rust, and PostgreSQL backends.
DevOps & Cloud Infrastructure: Normalizing environment variable keys (SCREAMING_SNAKE_CASE), Kubernetes labels (kebab-case), and Java/YAML properties (dot.case).
Digital Publishing & Programmatic SEO: Enforcing consistent Chicago or AP Title Case across CMS headlines and canonical RFC 3986 URL slugs.
Expert Tips & Best Practices
- When working with Google TypeScript/Java Style or Rust RFC 430 linters, switch Acronym Policy to 'Strict Camel' so adjacent acronyms like 'XMLHTTPRequest' become 'XmlHttpRequest' with unambiguous word boundaries.
- Always enable 'ASCII Fold (NFD)' when generating URL slugs or S3 object keys from user-entered titles so accented characters like 'é' or 'ü' fold cleanly to 'e' and 'u' instead of percent-encoded '%C3%A9'.
- Check the Reserved Keyword Collision Auditor when converting domain terms like 'order', 'user', 'group', 'case', or 'class' into SQL column names or Python variables.
Frequently Asked Questions
What is the difference between camelCase, PascalCase, snake_case, kebab-case, and SCREAMING_SNAKE_CASE?
camelCase (dromedaryCase) starts with a lowercase letter and capitalizes each subsequent joined word without spaces or punctuation (e.g., fetchUserToken), standard for JavaScript, TypeScript, and Java variables. PascalCase (UpperCamelCase) capitalizes every word including the first (FetchUserToken), standard for React components, C# methods, and TypeScript interfaces. snake_case lowercases all words and joins them with underscores (fetch_user_token), standard for Python (PEP 8), Rust, and PostgreSQL columns. SCREAMING_SNAKE_CASE uppercases all words with underscores (FETCH_USER_TOKEN) for POSIX .env variables and constants. kebab-case joins lowercase words with hyphens (fetch-user-token) for URLs, CSS classes, and npm packages.
How do Chicago Manual of Style (CMOS) and AP Style differ on Title Case capitalization?
Both Chicago (17th Ed.) and AP Style capitalize the first and last words of a title, words following a colon, and major nouns, verbs, adjectives, and adverbs, while lowercasing articles (a, an, the) and short coordinating conjunctions (and, but, or, nor, for, so, yet). Their primary divergence is on prepositions: Chicago lowercases ALL prepositions regardless of length (including 'with', 'between', 'through', 'against', 'during'), whereas AP Style and APA (7th Ed.) capitalize any preposition of 4 letters or more ('With', 'Between', 'Through', 'From', 'Into').
How does a lexical tokenizer split acronyms like 'XMLHttpRequest' or 'parseOAuth2Token' without breaking them into single letters?
A naive regex that splits before every uppercase letter breaks 'XMLHttpRequest' into 'X_M_L_Http_Request'. Instead, a two-pass Finite-State Automaton (FSA) looks ahead for two distinct transitions: (1) a sequence of two or more uppercase letters followed by an uppercase-then-lowercase letter ([A-Z]{2,})(?=[A-Z][a-z]), splitting 'XMLHttp' cleanly between 'XML' and 'Http'; and (2) a lowercase letter or digit followed by an uppercase letter ([a-z0-9])(?=[A-Z]), splitting 'HttpRequest' between 'Http' and 'Request'.
How does ASCII Bit 5 (0x20 = 32) convert characters between UPPERCASE and lowercase at the hardware level?
In the 7-bit US-ASCII table (ANSI X3.4), uppercase letters 'A'–'Z' occupy decimal codes 65–90 (0x41–0x5A, binary 0100 0001₂ to 0101 1010₂) and lowercase letters 'a'–'z' occupy decimal codes 97–122 (0x61–0x7A, binary 0110 0001₂ to 0111 1010₂). Because 97 − 65 = 32 (2⁵ = 0x20), every uppercase and lowercase pair differs by only Bit 5. Setting Bit 5 via bitwise OR (c | 0x20) converts to lowercase, clearing Bit 5 via bitwise AND (c & ~0x20) converts to uppercase, and XORing Bit 5 (c ^ 0x20) inverts case.