Case Converter

The Complete Case Converter Guide

How word-splitting makes any-to-any case conversion possible, when to use each naming convention, and how acronyms are handled correctly.

Open Case Converter

How Word-Splitting Makes Any-to-Any Conversion Possible

Every case format is really the same underlying list of words, just joined and capitalized differently. So instead of writing nine separate parsers - one per output format - this tool does the hard part once: it breaks your input down into a plain list of lowercase words, then each case format is just a different way of gluing that list back together.

The splitter looks for four kinds of word boundaries: plain whitespace, hyphens, underscores, and capital-letter transitions inside camelCase or PascalCase text (such as the boundary between "hello" and "World" in helloWorld). Because all four are detected at once, it doesn't matter what format your input started in - the same splitter handles hello world, hello-world, hello_world, and helloWorld identically, all producing the word list ["hello", "world"].

Case Formats Explained

FormatRuleExample
camelCaseFirst word lowercase, every following word capitalized, no separatorshelloWorldExample
PascalCaseEvery word capitalized, no separatorsHelloWorldExample
snake_caseAll lowercase, words joined with underscoreshello_world_example
kebab-caseAll lowercase, words joined with hyphenshello-world-example
CONSTANT_CASEAll uppercase, words joined with underscoresHELLO_WORLD_EXAMPLE
Title CaseEvery word capitalized, joined with spacesHello World Example
Sentence caseOnly the first word capitalized, joined with spacesHello world example

When to Use Each One

camelCaseJavaScript, Java, and C# variables and function names.
PascalCaseClass names, React/Vue component names, C# type names.
snake_casePython variables and functions, SQL column and table names.
kebab-caseURL slugs, CSS class names, HTML data attributes, command-line flags.
CONSTANT_CASEConstants and environment variables across most languages.
Title Case / Sentence casePage headings, UI labels, and regular prose respectively.

Handling Acronyms Correctly

A naive camelCase splitter that only looks for "lowercase followed by uppercase" gets confused by consecutive capital letters - it would treat all of XMLHttpRequest as one giant word, since there's never a lowercase-to-uppercase transition inside "XML". This tool adds a second rule specifically for that case: a run of capital letters immediately followed by a capitalized word (like "Http" after "XML") is also treated as a word boundary.

That means XMLHttpRequest correctly splits into XML, Http, and Request - so converting it to, say, kebab-case produces xml-http-request rather than an incorrectly merged xmlhttp-request.

Frequently Asked Questions

Does JavaScript (or any language) actually enforce camelCase or PascalCase?

No. Parsers and compilers for JavaScript, Python, Java, and most mainstream languages don't care about letter case at all - a variable named ALL_CAPS or under_scored runs exactly the same as one named camelCase. camelCase for variables, PascalCase for classes, and similar conventions are community style guides formalized by teams and documentation, not syntax rules enforced by the language itself.

Is kebab-case ever valid as an actual variable name?

Not in most mainstream languages. In JavaScript, Python, Java, and similar C-family languages, a hyphen inside an identifier is parsed as the minus operator, so my-variable would be read as my minus variable. That's why kebab-case shows up in URLs, CSS class names, and file names - contexts with no operator ambiguity - rather than in variable names. Lisp-family languages like Clojure are a notable exception, where hyphens are conventional in identifiers.

Why do languages like Java and C# capitalize class names but not variable names?

It's a deliberate readability convention: capitalizing type/class names (PascalCase) while lowercasing variables and methods (camelCase) lets a reader tell at a glance whether an identifier refers to a type or a value, without needing to trace back to its declaration. The compiler doesn't require this distinction - it's purely there for humans reading the code.

Why do environment variables and constants conventionally use CONSTANT_CASE?

It traces back to early Unix shells, where uppercase names visually separated environment/shell variables from regular commands and lowercase local variables. Programming languages carried the same convention over to compile-time constants, so CONSTANT_CASE now signals "this value won't change at runtime" the moment you see it, well before you'd need to check its declaration.

Open Case Converter