OmniFeed Search

Text case converter

Paste your text once and the converter writes it in camelCase, snake_case, kebab-case, and six other cases. The code cases split words at spaces, punctuation, and capital letters, so parseJSONFile becomes parse_json_file, while Title Case and the plain cases keep your punctuation. It runs in your browser; nothing you enter is uploaded.

camelCase
PascalCase
snake_case
CONSTANT_CASE
kebab-case
Title Case
Sentence case
UPPERCASE
lowercase

Where each case is used

The Python conventions above come from Python's style guide, PEP 8. For URLs, Google's URL structure guidelines recommend hyphens over underscores, so use kebab-case for page addresses.

How words are split

For the code cases, the converter first breaks your text into words. It splits at every space and punctuation mark, and wherever a lowercase letter or a digit comes right before a capital. When a run of capitals is followed by a capitalized word, the split goes just before that word's capital, so acronyms stay in one piece:

Title Case, Sentence case, UPPERCASE, and lowercase don't split anything. They only change letters, and your spaces, punctuation, and line breaks stay where they were.

What gets lost

Once you convert to a code case, you can't get the acronyms back. parseJSONFile in camelCase is parseJsonFile, and nothing in that result says JSON was all capitals. The converter also treats an apostrophe as punctuation, so the user's badge becomes the_user_s_badge. Remove apostrophes first if you don't want that extra word.

Title Case and Sentence case lowercase the whole text before capitalizing, so NASA becomes Nasa and names in the middle of a sentence lose their capital. Title Case also capitalizes every word, giving The Lord Of The Rings. Style guides such as AP and Chicago keep short words like "of" and "the" lowercase, so fix those by hand when you need a proper headline.

UPPERCASE follows Unicode's case rules, which can change the length of a word: the German straße becomes STRASSE.

Doing it in code

In JavaScript, toUpperCase() and toLowerCase() cover the plain cases, and the lodash library has camelCase, snakeCase, kebabCase, and startCase. Python has str.upper(), str.lower(), and str.title(). Be careful with title(): it treats an apostrophe as the end of a word, so it turns they're into They'Re.

In CSS, text-transform: uppercase or capitalize changes how text looks without changing the text itself. Use it when the case is only a matter of design, like a button label in capitals. Convert the text itself when the case has to be stored, such as in a name or a key.

More in text

Other tools