Case Converter

Published Updated

Switch pasted text between Sentence case, lower case, UPPER CASE, Title Case, camelCase, snake_case, kebab-case and PascalCase, with live counts of characters, words and lines.

Eight buttons, each with one fixed rule

Paste text, press a case, and the box is rewritten. Four buttons are for prose (Sentence case, lower case, UPPER CASE, Title Case) and four build names for code (camelCase, PascalCase, snake_case, kebab-case). The rules are simple and literal: no dictionary of names, no list of small words, and no memory of the text before the last click.

That literalness is the thing to know. Lowercasing is one way: once iPhone has become iphone, no button brings the capital P back.

Each button on a sample

Outputs below were produced by running the tool's own functions on the input shown:

ButtonInputOutput
Sentence casewe met NASA staff in paris. they said hi! okWe met nasa staff in paris. They said hi! Ok
lower caseiPhone sales in the USAiphone sales in the usa
UPPER CASEStraßeSTRASSE
Title Casethe lord of the ringsThe Lord Of The Rings
camelCaseuser account iduserAccountId
PascalCasefirst_name last-nameFirstNameLastName
snake_casefirst_name last-namefirst_name_last_name
kebab-casehello, worldhello,-world

Where the rules trip up

Four behaviours explain most surprising results:

  • In the four code cases, spaces, underscores, dashes and a capital after a lowercase letter all start a new word. That turns myVariableName into my_variable_name, but it also turns iPhone into i_phone.
  • camelCase and PascalCase also split at _ and -, but punctuation stays inside the name: hello, world becomes hello,World.
  • Unicode case rules can change the length of a word. Uppercasing ß gives SS, as MDN's toLocaleUpperCase page shows with Gesäß.
  • No language setting is applied. Turkish dotted İ lowercases to i plus a combining dot, so İstanbul becomes 9 characters; the Turkish rule that gives a plain i is described on MDN's toLocaleLowerCase page.

Code names: what survives a round trip

We ran the converter's own functions (lib/caseConvert.ts) in Node 22.23.1 on a list of names and read every result. A name is split into words at spaces, underscores, dashes and at the capitals inside it, and then written back in the case you picked. Acronyms are the weak spot, because a word in capitals is written back as an ordinary word.

InputcamelCasesnake_casePascalCase
XMLHttpRequestxmlHttpRequestxml_http_requestXmlHttpRequest
getHTTPResponseCodegetHttpResponseCodeget_http_response_codeGetHttpResponseCode
userIDsuserIdsuser_idsUserIds
PDFspdfspdfsPdfs
iPhoneCaseiPhoneCasei_phone_caseIPhoneCase
html5Parserhtml5Parserhtml5_parserHtml5Parser
3DModel3dModel3d_model3dModel
e-mail addresseMailAddresse_mail_addressEMailAddress
hello, worldhello,Worldhello,_worldHello,World

Twelve camelCase names (userAccountId, html5Parser, base64Decode and nine more) went to snake_case and back to camelCase unchanged, and ten snake_case names went to camelCase and back unchanged. The names that do not come back are the ones with an acronym: XMLHttpRequest went to xml_http_request and came back as xmlHttpRequest.

Pressing a button twice is also worth knowing about. On ten test lines, a second press of lower case, UPPER CASE, Sentence case, Title Case, snake_case or kebab-case changed nothing. A second press of camelCase or PascalCase changed three of the ten, all of them lines with punctuation inside the text: hello,World became hello,world, because the first press leaves the comma attached to the word before it and the second press treats the capital as part of a name and lowers it.

Sentence case: the full stop is the only signal

Sentence case lowercases everything and then capitalizes the first letter of the text and the first letter after a full stop, exclamation mark or question mark. It does not know which full stops end a sentence. Results from the same run:

InputSentence case resultWhat happened
Dr. smith arrived. he sat.Dr. Smith arrived. He sat.The S after Dr. is capitalized as it would be after any full stop. Here that suits a name, but the rule cannot tell the two cases apart.
e.g. this one. and i.e. that oneE.G. This one. And i.E. That oneLetters after each full stop in an abbreviation are capitalized.
a.b.c.dA.B.C.DEvery letter after a full stop is capitalized.
3.5 is a number. so is 4.53.5 is a number. So is 4.5A full stop between digits is skipped, because no lowercase letter follows it.
"quoted." next one"quoted." next oneA quotation mark stands before the first letter and another between the full stop and the next word, so neither word is capitalized.
éa. élanÉa. ÉlanAccented letters are capitalized like any other.

Check the result when the text holds abbreviations, web addresses or quotations. Proper names and acronyms are lowercased too, so NASA becomes nasa and has to be retyped.

Accented, Greek, Turkish and other letters in three browsers

We ran each of the eight buttons on 21 inputs in other alphabets and spellings in Google Chrome 157, Firefox 155 and Playwright's WebKit build (not the Safari app). All 168 results were the same in the three browsers. The rows most likely to surprise:

InputButtonResultWhat happened
istanbul ılıkUPPER CASEISTANBUL ILIKBoth i and the dotless ı become a plain I. No Turkish rule is applied, so no İ appears.
İZMİRlower casei̇zmi̇rEach İ becomes i plus a combining dot above (U+0307), so 5 letters become 7 characters.
ΟΔΟΣ ΩΣlower caseοδος ωςA Σ at the end of a word becomes the final form ς. Title Case gives Οδος Ως.
άλφα βήταUPPER CASEΆΛΦΑ ΒΉΤΑThe accents stay on the capitals.
ẞ (capital sharp s)lower caseßThe way back differs: UPPER CASE turns ß into SS, as in STRASSE.
ijsselmeerTitle CaseIjsselmeerOnly the i is capitalized; there is no rule for the Dutch IJ. The single letter ij (U+0133) gives IJssel.
final flow office, typed with the single characters fi and fl (U+FB01, U+FB02)Title CaseFinal Flow OfficeA ligature that starts a word splits into a capital and a small letter; one inside a word stays. UPPER CASE gives FINAL FLOW OFFICE, and lower case leaves the ligatures alone.
džungla ljubljana njošTitle CaseDžungla Ljubljana NjošThe one-character digraphs get their title-case forms Dž, Lj and Nj. UPPER CASE gives DŽUNGLA LJUBLJANA NJOŠ.
café école, typed as e plus a combining accent (U+0301)Title CaseCafé ÉcoleThe accent stays a separate mark after its letter; nothing is merged into é.
москва ПРИВЕТTitle CaseМосква ПриветCyrillic follows the same rules as Latin letters.

What the counters under the box count

The four counters read the text as the browser hands it to the page. Characters is the string length, which MDN's String length page defines in UTF-16 code units, so it is not always the number of symbols you see. Results from the page's own counters, the same in Chrome 157, Firefox 155 and the WebKit build:

Text in the boxCharactersCharacters (no spaces)WordsLines
café (é as one character)4411
café (e plus a combining accent)5511
👍2211
👍🏽 (with a skin tone)4411
👨‍👩‍👧 (three people joined into one emoji)8811
🇩🇪 (a flag)4411
日本語3311
a, a Windows line break (CR LF), b3222
a and one line break after it2112
e-mail and/or word—word232131
a and b joined by a no-break space3221
a and b joined by a zero-width space3311
three spaces3001

A Windows line break counts once. The HTML standard says the text a page reads from a text box is "normalized so that line breaks use U+000A LINE FEED (LF) characters" (HTML Living Standard, the textarea element), and all three browsers handed the page a, LF, b. Words are runs of text between whitespace: a hyphen, a slash or a dash keeps two words together, a no-break space or an ideographic space separates them, and a zero-width space does not.

How fast it runs

For speed we repeated one sentence of 91 characters and ran each button once in Node, so these are single runs without the text box of the page. At 91,000 characters lower case and UPPER CASE took under 1 ms and Title Case 5 ms, while the four code cases took 35 to 43 ms. At 910,000 characters the code cases took 323 to 363 ms and Title Case 46 ms. At 9,100,000 characters the code cases took about 3.3 to 3.5 seconds and lower case and UPPER CASE 5 and 3 ms. On the page itself, we timed each button from the click until the box held the new text and was laid out, on a 90-character sentence repeated 1,000 times (90,000 characters) and 10,000 times (900,000 characters). Medians of 5 presses on one computer:

ButtonChrome 157 (90,000 / 900,000 characters)Firefox 155WebKit build
Sentence case12 / 96 ms9 / 84 ms5 / 53 ms
lower case11 / 90 ms8 / 78 ms4 / 50 ms
UPPER CASE10 / 88 ms9 / 79 ms4 / 54 ms
Title Case13 / 111 ms13 / 131 ms8 / 74 ms
camelCase17 / 166 ms28 / 260 ms37 / 344 ms
snake_case17 / 165 ms26 / 261 ms40 / 387 ms
kebab-case17 / 158 ms28 / 272 ms12 / 109 ms
PascalCase17 / 162 ms26 / 269 ms36 / 336 ms

The four code cases were the slowest in every browser, up to 387 ms for snake_case on 900,000 characters in the WebKit build.

Changing the case of your text

  1. Step 1

    Paste the text

    Characters, characters without spaces, words and lines are counted below the box as you type.

  2. Step 2

    Click a case

    The box is overwritten with the result. A second click converts that result again, so copy the original first if you may need its capitals back.

  3. Step 3

    Copy it

    Copy to Clipboard takes everything in the box, and Clear empties it for the next piece of text.

Which case goes where

CaseTypical useSource of the convention
snake_casePython function and variable namesPEP 8: lowercase words separated by underscores
PascalCasePython class namesPEP 8 calls it CapWords
UPPER CASE with underscoresPython constantsPEP 8; type it with spaces, press UPPER CASE, then replace spaces
kebab-caseWords in a URLGoogle Search Central recommends hyphens over underscores

Related tools: Title Case Converter for headlines with small words kept lowercase, Slug Generator for clean URLs, and Word Counter for reading time.

Case conversion questions

Why did Title Case capitalize of, the and and?

This button gives every word a capital first letter, short words included, so the lord of the rings becomes The Lord Of The Rings. For headline style, where words like of and the stay lowercase, use the Title Case Converter instead.

Why did Sentence case turn NASA and Paris into lowercase?

It lowers everything, then raises the first letter of the text and the first letter after each full stop, question mark or exclamation mark. It knows no names or acronyms, so proper nouns need fixing by hand afterwards.

Can it turn myVariableName into snake_case?

Yes. A capital that follows a lowercase letter starts a new word, so snake_case gives my_variable_name and PascalCase gives MyVariableName. A run of capitals stays one word, as in XMLHttpRequest to xml_http_request, and a plural such as PDFs is kept whole.

Why did my list of names merge into one long name?

camelCase, PascalCase, snake_case and kebab-case treat a line break like a space, so two lines reading line one and line two become line_one_line_two. Convert names one at a time, or use lower, UPPER or Title Case, which keep the lines apart.

Does it work with accents and other alphabets?

Yes. Every button follows Unicode case rules, so Straße becomes STRASSE, Title Case turns élan vital into Élan Vital, and Cyrillic and Greek words get their capitals too. In Title Case, a word that starts with ß gets Ss. Turkish gets no special treatment: a plain i is capitalized without a dot, as in English.

Which case should I use for a URL?

Google recommends hyphens between words in URLs, so kebab-case is the right family. Note that this tool keeps commas and apostrophes, giving hello,-world; the Slug Generator removes them.

Why did XMLHttpRequest come back as xmlHttpRequest?

The converter writes every word after the first as a capital followed by lowercase letters, and it has no list of acronyms. In our test XMLHttpRequest became xml_http_request in snake_case and xmlHttpRequest when converted back, so an acronym in capitals does not survive a round trip.

Does pressing the same button twice change the text?

For the prose buttons, snake_case and kebab-case, a second press changed nothing on ten test lines. camelCase and PascalCase changed three of the ten when the text held punctuation, for example hello,World became hello,world.

Why were letters after the dots in e.g. capitalized?

Sentence case capitalizes the first letter after every full stop, exclamation mark or question mark, and it cannot tell an abbreviation from the end of a sentence. In our test e.g. this one became E.G. This one. Fix abbreviations by hand after converting.

How much text can it convert?

In Node, a text of 9.1 million characters took about 3.5 seconds for the slowest buttons, the four code cases, and under 40 ms for lower case, UPPER CASE and Sentence case and about 0.3 seconds for Title Case, in single runs. On this page, a generated 900,000-character text took 88 to 166 ms per press in Chrome 157, 78 to 272 ms in Firefox 155 and 50 to 387 ms in the WebKit build (medians of 5 presses), with the four code cases the slowest.

Why does one emoji count as 2, 4 or 8 characters?

The Characters counter shows the string length in UTF-16 code units. A thumbs-up emoji counted 2, the same emoji with a skin tone 4, a flag 4 and a family emoji of three people 8, alike in Chrome 157, Firefox 155 and the WebKit build. An accent typed as a separate combining mark adds one as well: café counted 4 with é as one character and 5 with e plus the accent.

Does a Windows line break count as two characters?

No. The browser's text box turns CR LF into a single line feed before the page reads it, so a, a Windows line break and b counted 3 characters and 2 lines in all three browsers. A line break at the very end still adds a line: a followed by one line break shows Lines: 2.

Why did UPPER CASE turn Turkish istanbul into ISTANBUL instead of İSTANBUL?

No language setting is applied, so i becomes I and the dotless ı becomes I too. The other way round, İZMİR in lower case gives i̇zmi̇r, where each i carries a separate combining dot: 7 characters for 5 letters. Chrome 157, Firefox 155 and the WebKit build gave the same results.

Why does e-mail count as one word?

Words are counted between whitespace only. The line e-mail and/or word—word counted 3 words, because hyphens, slashes and dashes join. A no-break space or an ideographic space splits two words; a zero-width space does not, so a and b joined by one counted as 1 word.

Related Tools