Case Conversion, Explained
After reading this you will know how eleven casing styles are defined, how a converter finds word boundaries in your text, and where the rules quietly disagree so your output surprises you.
Case conversion looks trivial until you feed it a real string. Turn userID 42 into snake_case and you get user_id_42, not userid_42 or user_i_d_42. The interesting work is not uppercasing letters. It is deciding where one word ends and the next begins, then re-joining those words with the right separator and the right capitalization.
This tool shows all eleven outputs at once, so you can compare a single input across every style without re-running anything. This guide explains the boundary rules and the per-style formatting so you can predict the result before you paste.
What the eleven styles actually are
Group the styles by two questions: what separates the words, and how each word is capitalized. Once you see the grid, the eleven styles collapse into a small set of choices.
| Style | Separator | Word casing | Result |
|---|---|---|---|
| lowercase | space | all lower | user profile id |
| UPPERCASE | space | all upper | USER PROFILE ID |
| Title Case | space | first letter up | User Profile Id |
| Sentence case | space | first word up | User profile id |
| camelCase | none | first lower, rest up | userProfileId |
| PascalCase | none | each up | UserProfileId |
| snake_case | underscore | all lower | user_profile_id |
| kebab-case | hyphen | all lower | user-profile-id |
| CONSTANT_CASE | underscore | all upper | USER_PROFILE_ID |
| dot.case | dot | all lower | user.profile.id |
| aLtErNaTiNg | space | per-letter toggle | uSeR PrOfIlE Id |
Ten of the eleven styles decide casing per word. Only aLtErNaTiNg works per letter, flipping between lower and upper as it walks the string. That single difference makes it the odd one out in every rule below.
When to use each, and when not to
The identifier styles exist because most programming languages forbid spaces in names. Each community picked a convention:
- snake_case
- Python variables and functions, SQL column names, many file names.
- camelCase
- JavaScript and Java variables and methods.
- PascalCase
- Class and type names in most languages, also called UpperCamelCase.
- kebab-case
- URL slugs, CSS class names, npm package names. Hyphens are legal in these; underscores often are not.
- CONSTANT_CASE
- Constants and environment variables such as
MAX_RETRIES. - dot.case
- Config keys and namespaces, for example
server.port.
Title Case and Sentence case are for prose, not code. Reach for them on headings and UI labels. Do not use them on data you plan to compare later: capitalization changes turn iPhone into Iphone and break exact matches.
Case conversion is not always reversible. Converting iOS to lowercase gives ios, and no converter can restore the original capitals from that. If you need the original back, keep a copy before you transform.
The one rule that governs everything: word boundaries
Every style starts by splitting your input into a list of words. The tool inserts a boundary wherever any of these is true:
- A run of whitespace or punctuation. Spaces, tabs, hyphens, underscores, dots and slashes all separate words and are then discarded.
- A lowercase letter followed by an uppercase letter: the
rPinuserProfilesplits intouserandProfile. - A digit next to a letter:
id42splits intoidand42. - An acronym boundary: in a run of capitals followed by a lowercase letter, the last capital starts a new word.
HTMLParserbecomesHTMLplusParser, notH,T,M,L,Parser.
The reason userID becomes user_id is rule 4. The scan sees user, then a run of two capitals ID. Because no lowercase letter follows the D, the whole run ID stays as one word, lowercased to id. Contrast userIDs: here the trailing s is lowercase, so the boundary falls before the D, giving user, ID, s and the odd result user_id_s. Acronyms glued to plurals are a known trap.
Once the words are extracted, they carry no capitalization of their own. The converter lowercases every word to a canonical form, then applies the target style's casing. That is why USER, user and User all produce the same snake_case output.
Title Case is the exception with a rulebook
Title Case does not simply capitalize every word. Style guides keep short function words lowercase inside a title. The Chicago Manual of Style and the AP Stylebook both lowercase articles (a, an, the), coordinating conjunctions (and, but, or) and short prepositions (of, in, on). The tool applies a common combined list.
Two positions override the list. The first word and the last word of a title are always capitalized, even if they appear in the stop list. So the end of time becomes The End of Time: The is capitalized because it leads, of stays lowercase in the middle, and Time is capitalized because it trails.
The stop-word list is a heuristic, not a grammar engine. It cannot tell that "on" is a preposition in "based on data" but part of a phrasal verb in "log on now". If precise editorial titling matters, review the output by hand.
A worked example you can reproduce
Converting "userID 42 done" across every style
Paste userID 42 done and follow the boundary scan.
- Read
user, thenID(rule 2 splits atrI; rule 4 keepsIDwhole). - A space ends the token. The digits
42form their own word (rule 3). - Another space, then
done. - The word list is
[user, ID, 42, done], canonicalized to[user, id, 42, done].
Now apply each style to that list:
| Style | Output |
|---|---|
| lowercase | userid 42 done |
| UPPERCASE | USERID 42 DONE |
| Title Case | Userid 42 Done |
| Sentence case | Userid 42 done |
| camelCase | userId42Done |
| PascalCase | UserId42Done |
| snake_case | user_id_42_done |
| kebab-case | user-id-42-done |
| CONSTANT_CASE | USER_ID_42_DONE |
| dot.case | user.id.42.done |
| aLtErNaTiNg | uSeRiD 42 DoNe |
Notice two things. The space-separated styles (lowercase, UPPERCASE, Title, Sentence, alternating) keep the space and print userid as one token, because there was never a space inside userID. The joined and separated identifier styles rebuilt the word list and inserted a boundary between user and id. Same input, different word grouping in the output, driven entirely by whether the style preserves the original spacing or rebuilds from the word list.
Watch the boundary rules interact
The chart below counts how many words the scan extracts from a few inputs. The count is what drives every separator-based style: three words means two separators.
userIDs splits into three words while userID splits into two, because the trailing lowercase s pulls the acronym boundary forward.Common mistakes
Assuming a round trip. snake_case to camelCase and back is safe only when no original casing was lost. APIKey to snake_case gives api_key, and back to Pascal gives ApiKey, not APIKey. The acronym flattened.
Non-ASCII letters. Casing rules are language-dependent. The Turkish dotless ı and dotted i uppercase differently from English. If your text mixes scripts or you need locale-correct casing, verify the result rather than trusting a single pass. To strip accents entirely before casing, use the Accent & Diacritic Remover.
Feeding whole paragraphs to identifier styles. camelCase on a sentence produces one enormous run-on token. Identifier styles are for short names. For reshaping long text into lines or columns, use Truncate, Pad & Wrap.
Related tools
Case conversion often sits inside a larger cleanup. To collapse repeated or reorder lines after converting, see Line Tools: Dedupe, Sort & Shuffle. To change casing only where a pattern matches, Find & Replace with Regex gives you targeted control. For playful transforms beyond aLtErNaTiNg, try Reverse & Upside-down Text.
Frequently asked questions
Why does userID become user_id and not userid?
The scanner treats a run of capitals as an acronym and gives it its own word when no lowercase letter follows. user and ID are two words, so snake_case joins them with an underscore.
What is the difference between camelCase and PascalCase?
Only the first letter. camelCase lowercases the first word (userProfile); PascalCase capitalizes every word including the first (UserProfile). Everything else is identical.
Does Title Case follow one official standard?
No. Chicago, AP and MLA differ on which short words stay lowercase and on the preposition length cutoff. The tool uses a common combined stop list and always capitalizes the first and last word. Check against your required style guide for publication.
Is my text sent anywhere?
No. The conversion runs entirely in your browser. Nothing you paste leaves your device.
Can I convert back to the original text?
Only when no information was lost. Lowercasing and acronym flattening are one-way: from ios or api_key the original iOS or APIKey cannot be recovered. Keep a copy of the source if you need it.