← Blog · · ConvertCaseHQ Team · 7 min read

How to Detect and Fix Random Capitalization in Bulk Text

To fix random capitalization in bulk text, first work out which kind of mess you have, then reset the text with one predictable conversion, then put back the capitals no tool can guess: names, acronyms and brands. A Caps Lock accident can be reversed exactly. Text typed in ALL CAPS or scrambled into mIxEd case can't, because the information about which letters should be capitals is already gone.

Three kinds of random capitalization

Caps Lock accidents

On Windows, and on other systems where Shift reverses Caps Lock, typing normally with Caps Lock on produces an exact negative of what you meant. The letters you meant to capitalize come out lowercase and everything else comes out in capitals:

tHE REPORT IS DUE ON fRIDAY. pLEASE SEND IT TO mARIA.

This is the one case with a perfect fix. iNVERSE cASE swaps every letter, which gives back exactly what you meant to type: "The report is due on Friday. Please send it to Maria." Microsoft Word can also catch it as you type, with an AutoCorrect setting literally called "Correct accidental use of cAPS LOCK key", listed on Microsoft's AutoCorrect options page.

All caps

Shouty emails, exports from older systems, form fields filled in with Caps Lock on. Every letter is a capital, so the text no longer tells you which words are names. "US" might be the country or the pronoun.

mIxEd case

Broken scripts, OCR errors, scraped pages, sarcastic memes. Some letters are right, some are wrong, and there's no pattern to reverse.

How to detect random capitalization with regex

In a long document, find the problems before you change anything. Paste the text into our regex tester and try these patterns with the g flag:

Caps Lock signature (tHIS, cAPS):
  \b[a-z][A-Z]{2,}\b

Words that switch from lower to upper case inside the word:
  \b\w*[a-z][A-Z]\w*

Four or more all-caps words in a row:
  \b[A-Z]{2,}(?:\s+[A-Z]{2,}){3,}\b

Whole lines with no lowercase letters (use the flags gm):
  ^[^a-z]+$

The second pattern gives you a review list, not a delete list. It flags "rePort" and "tHIS", but also "iPhone", "eBay" and "McDonald", which are correct. That's the theme of this whole job: a pattern can find suspicious capitals, but only someone who knows the subject can say which ones are wrong.

One limitation: these patterns only see unaccented English letters, because [a-z], [A-Z], \w and \b are ASCII-based in JavaScript. For other alphabets you'll need Unicode property escapes such as \p{Lu} (capital letters) and \p{Ll} (lowercase letters), which work with the u flag.

The two-pass fix: reset, then restore

Pass 1: reset with Sentence case

For prose, the reset is Sentence case in our case converter. It lowercases everything, then capitalizes the first letter of the text and the first letter after a full stop, question mark or exclamation mark followed by a space, even when the sentence opens with a quotation mark. In text with normal capitals it keeps short acronyms and names like iPhone as typed, but in all-caps or jumbled text it can't tell them apart, so it doesn't try. Here's an all-caps paragraph before and after:

Before:
THE NASA TEAM MET ACME CORP IN PARIS ON MONDAY. i THINK THE IPHONE
DEMO WENT WELL, BUT i'M NOT SURE THE U.S. OFFICE AGREES.

After Sentence case:
The nasa team met acme corp in paris on monday. I think the iphone
demo went well, but i'm not sure the u.s. Office agrees.

Count the damage. NASA, Acme Corp, Paris, Monday, iPhone and U.S. are all lowercase. The "i" in the middle of the second sentence is still lowercase. And "Office" got a capital because the converter read the full stop in "U.S." as the end of a sentence. None of that is a bug. A case converter sees letters and punctuation; it has no idea what NASA is.

Pass 2: restore names with word-boundary replacements

Now put the capitals back in Find & Replace, one term per pass, with Regex ticked and Case insensitive left unticked:

Find: \bnasa\b             Replace: NASA
Find: \bacme corp\b        Replace: Acme Corp
Find: \bparis\b            Replace: Paris
Find: \bmonday\b           Replace: Monday
Find: \biphone\b           Replace: iPhone
Find: \bu\.s\. Office      Replace: U.S. office
Find: \bi(?=[\s'’])        Replace: I

The \b word boundaries are what make this safe. A plain search for "nasa" also matches the start of "nasal", and replacing every match would leave you with "NASAl spray". The last pattern fixes the pronoun "i" only when a space or an apostrophe follows it, so "i.e." is left alone. The output panel's heading shows how many matches each pass made, which is a quick sanity check before you copy anything.

Keep a note of the names you restore. If you fix text from the same company or project often, that note becomes a terminology list, the same list we suggest every team writes down in our guide to writing consistent documentation.

Fixing capitalization in lists and data columns

Lists, spreadsheet columns and CSV fields need a slightly different approach, for two reasons.

First, Sentence case treats your text as running prose. It capitalizes after sentence-ending punctuation, not after a line break, so on a column of product names only the first line gets a capital. To sentence-case each line separately, add a temporary marker to every line, convert, then remove the marker:

  1. In our Add Prefix & Suffix to Each Line tool, set the suffix to a space followed by a full stop.
  2. Run Sentence case on the result.
  3. In Find & Replace, with Regex ticked, find [ ]\.(?=\n|$) and replace it with nothing.

"WATERPROOF HIKING BOOTS" becomes "Waterproof hiking boots", line by line. Check sizes and model codes afterwards, though: "SIZE M" becomes "size m" like everything else.

Second, with names, decide whether to touch a row at all. Capitalized Case turns "JEAN-LUC O’BRIEN" into "Jean-luc O’brien", which is wrong twice. Title Case handles the hyphen (Jean-Luc) but still gives "O’brien", and both turn MCDONALD into "Mcdonald". Rows already in mixed case are probably right, so fix only the rows that are entirely upper- or lowercase. In the regex tester, with the gm flags, ^[^a-z]+$ finds the all-caps rows and ^[^A-Z]+$ finds the all-lowercase ones.

What automated tools can't know

  • Proper nouns. A converter can't tell Mercury the planet from mercury the metal, or know that "paris" is a city. Brand names with unusual capitals, like iPhone or eBay, are worse once the text has been through Caps Lock, because nothing in "IPHONE" says which letters were small.
  • Acronyms versus ordinary words. US and us, IT and it, AIDS and aids. Once the text has been lowercased the difference is gone, and nothing left in the text can bring it back.
  • Abbreviations with full stops. "e.g.", "U.S." and "etc." look like sentence endings, so the word after them gets a capital it shouldn't have.
  • Unpunctuated boundaries. Headings, list items and table cells usually end without a full stop, so a sentence-based rule can't see where they end.
  • Deliberate exceptions. Brands styled in lowercase, quotations that must stay as written, code identifiers.

That's why the reset is the easy half. The restore needs knowledge of the subject, which is also the one step where an AI assistant can genuinely help, by suggesting which lowercase words look like names. Treat its suggestions as a list to check, not as the fix.

A checklist for bulk capitalization fixes

  1. Keep a copy of the original. Lowercasing throws information away, and the converter's undo history is gone once you close or reload the page.
  2. Diagnose: Caps Lock accident, all caps, or mixed case?
  3. Caps Lock accident: run Inverse case and you're done.
  4. Otherwise reset: Sentence case for prose, the suffix trick for one-entry-per-line lists, Title Case only where you actually want title case.
  5. Restore names and acronyms with word-boundary replacements, one term at a time.
  6. Compare the original and the result side by side before the text goes anywhere.

The rule of thumb: a tool can make capitalization consistent, but only a person, or a list a person wrote, can make it correct.

© 2026 ConvertCaseHQ. All rights reserved.