CCalclabhub

How To Convert Text Case Calculator

Changing the case of a piece of text is not a single operation. There are at least eight named styles, each with its own rules, and picking the wrong one is as much a mistake as getting the letters wrong.

Title Case

How to Convert Text Between Naming Styles

Characters in
41
Words in
7
Characters out
41

camelCase, PascalCase, snake_case and kebab-case split on spaces, punctuation and existing camel boundaries, so mixed input still converts cleanly.

The formula this calculator uses

Title Case = capitalise each significant word, lower-case the small ones

word
A run of letters, digits or hyphens
small word
Articles, conjunctions and short prepositions
separator
Space, underscore or hyphen between words

How to check the result by hand

  1. 1

    Split the text into words

    Break on spaces and punctuation, and also on the capital letters inside camelCase, so that customerAccountBalance becomes three words rather than one.

  2. 2

    Normalise the letters

    Decide the target case for each word. Upper and lower case apply to the whole string; the other styles work word by word.

  3. 3

    Apply the style rule

    Title Case capitalises significant words and leaves small words alone. camelCase lower-cases the first word, snake_case and kebab-case lower-case everything.

  4. 4

    Join with the right separator

    A space for Title and Sentence case, nothing for camel and Pascal, an underscore for snake and a hyphen for kebab.

  5. 5

    Check the result reads correctly

    Acronyms and proper nouns often need manual repair. An identifier such as userId may come back as User Id or user id depending on how the splitter treats the capitals.

For worked examples, common mistakes and the limits of this formula, read the full How To Convert Text Case page.