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:
| Button | Input | Output |
|---|---|---|
| Sentence case | we met NASA staff in paris. they said hi! ok | We met nasa staff in paris. They said hi! Ok |
| lower case | iPhone sales in the USA | iphone sales in the usa |
| UPPER CASE | Straße | STRASSE |
| Title Case | the lord of the rings | The Lord Of The Rings |
| camelCase | user account id | userAccountId |
| PascalCase | first_name last-name | FirstNameLastName |
| snake_case | first_name last-name | first_name_last_name |
| kebab-case | hello, world | hello,-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.
| Input | camelCase | snake_case | PascalCase |
|---|---|---|---|
| XMLHttpRequest | xmlHttpRequest | xml_http_request | XmlHttpRequest |
| getHTTPResponseCode | getHttpResponseCode | get_http_response_code | GetHttpResponseCode |
| userIDs | userIds | user_ids | UserIds |
| PDFs | pdfs | pdfs | Pdfs |
| iPhoneCase | iPhoneCase | i_phone_case | IPhoneCase |
| html5Parser | html5Parser | html5_parser | Html5Parser |
| 3DModel | 3dModel | 3d_model | 3dModel |
| e-mail address | eMailAddress | e_mail_address | EMailAddress |
| hello, world | hello,World | hello,_world | Hello,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:
| Input | Sentence case result | What 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 one | E.G. This one. And i.E. That one | Letters after each full stop in an abbreviation are capitalized. |
| a.b.c.d | A.B.C.D | Every letter after a full stop is capitalized. |
| 3.5 is a number. so is 4.5 | 3.5 is a number. So is 4.5 | A full stop between digits is skipped, because no lowercase letter follows it. |
| "quoted." next one | "quoted." next one | A 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. Élan | Accented 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:
| Input | Button | Result | What happened |
|---|---|---|---|
| istanbul ılık | UPPER CASE | ISTANBUL ILIK | Both i and the dotless ı become a plain I. No Turkish rule is applied, so no İ appears. |
| İZMİR | lower case | i̇zmi̇r | Each İ 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. |
| ijsselmeer | Title Case | Ijsselmeer | Only 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 Case | Final Flow Office | A 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 Case | Dž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 Case | Café École | The 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 box | Characters | Characters (no spaces) | Words | Lines |
|---|---|---|---|---|
| café (é as one character) | 4 | 4 | 1 | 1 |
| café (e plus a combining accent) | 5 | 5 | 1 | 1 |
| 👍 | 2 | 2 | 1 | 1 |
| 👍🏽 (with a skin tone) | 4 | 4 | 1 | 1 |
| 👨👩👧 (three people joined into one emoji) | 8 | 8 | 1 | 1 |
| 🇩🇪 (a flag) | 4 | 4 | 1 | 1 |
| 日本語 | 3 | 3 | 1 | 1 |
| a, a Windows line break (CR LF), b | 3 | 2 | 2 | 2 |
| a and one line break after it | 2 | 1 | 1 | 2 |
| e-mail and/or word—word | 23 | 21 | 3 | 1 |
| a and b joined by a no-break space | 3 | 2 | 2 | 1 |
| a and b joined by a zero-width space | 3 | 3 | 1 | 1 |
| three spaces | 3 | 0 | 0 | 1 |
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:
| Button | Chrome 157 (90,000 / 900,000 characters) | Firefox 155 | WebKit build |
|---|---|---|---|
| Sentence case | 12 / 96 ms | 9 / 84 ms | 5 / 53 ms |
| lower case | 11 / 90 ms | 8 / 78 ms | 4 / 50 ms |
| UPPER CASE | 10 / 88 ms | 9 / 79 ms | 4 / 54 ms |
| Title Case | 13 / 111 ms | 13 / 131 ms | 8 / 74 ms |
| camelCase | 17 / 166 ms | 28 / 260 ms | 37 / 344 ms |
| snake_case | 17 / 165 ms | 26 / 261 ms | 40 / 387 ms |
| kebab-case | 17 / 158 ms | 28 / 272 ms | 12 / 109 ms |
| PascalCase | 17 / 162 ms | 26 / 269 ms | 36 / 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
Step 1
Paste the text
Characters, characters without spaces, words and lines are counted below the box as you type.
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.
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
| Case | Typical use | Source of the convention |
|---|---|---|
| snake_case | Python function and variable names | PEP 8: lowercase words separated by underscores |
| PascalCase | Python class names | PEP 8 calls it CapWords |
| UPPER CASE with underscores | Python constants | PEP 8; type it with spaces, press UPPER CASE, then replace spaces |
| kebab-case | Words in a URL | Google 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.