Skip to the tool
DevToolBench

Case Converter

Nine naming conventions from any input, acronyms included.

0 lines
Words
0
Lines
0
Characters
0
Output
0

Every convention, applied to the first line

camelCase
PascalCase
snake_case
SCREAMING_SNAKE
kebab-case
Title Case
Sentence case
lower case
UPPER CASE

Everything runs in your browser. Nothing you type is sent to a server.

Found a bug in this tool? Report it.

Share this tool

One name, nine spellings

This case converter takes whatever you paste — XMLHttpRequest, user_first_name, The Art of War — and rewrites it as camelCase, PascalCase, snake_case, SCREAMING_SNAKE_CASE, kebab-case, Title Case, Sentence case, lower case or UPPER CASE. There is one step behind all nine: the input is broken into words, and every convention is then a way of gluing that list back together.

That step is the whole difficulty. Separators are easy; the boundaries hidden inside getHTTPStatus are not.

Where each convention actually lives

The choice is rarely yours alone — the receiving side has a convention and you are matching it:

  • camelCase — JavaScript and Java identifiers, and the keys of most JSON produced by those languages. Also the default for GraphQL fields.
  • PascalCase — types, classes and React components in nearly every language that has them; also .NET method names, which is why C# JSON tends to arrive capitalised.
  • snake_case — Python and Ruby variables, SQL columns, and the JSON of anything with a Rails or Django backend. It is also the safest choice for a filename that a shell will touch.
  • SCREAMING_SNAKE_CASE — environment variables and compile-time constants, and effectively mandatory for the former: shells treat lowercase names as ordinary variables.
  • kebab-case — CSS classes and custom properties, HTML attributes, npm package names, and URLs. It cannot be an identifier in most languages because the hyphen is a minus sign.
  • Title Case and Sentence case — headings and interface labels, where the argument is with a style guide rather than a compiler.

The acronym problem

Naive splitters break on every capital, so XMLHttpRequest becomes x_m_l_http_request and parseHTMLDocument becomes something no one wants to read. The fix is to treat a run of capitals as one word, but hand the final capital to the word after it — because in XMLHttp the H starts Http, while in exportToPDF the run reaches the end and stays whole.

Converting back is where information is lost, and it is worth saying plainly: XMLHttpRequest in and XmlHttpRequest out. The tool knows the boundaries, not that three of those letters were an initialism. If a codebase cares — and Microsoft's own guidance says two-letter acronyms keep both capitals while longer ones do not — convert a copy and fix the acronym by hand.

Digits get the same treatment as a separate word: parseInt32Value splits into four, which is what the popular libraries do and what makes the conversion reversible.

Title Case and the short words

Title Case is not a mechanical rule, which is why two tools disagree about it. The convention here is AP style: capitalise everything except a fixed list of twenty-two short articles, conjunctions and prepositions, and capitalise those anyway when they open or close the title. The Lord of the Rings keeps of and the second the in lowercase; Of Mice and Men capitalises the Of because it comes first.

Chicago style differs — it capitalises prepositions of five letters or more and has its own exceptions — so if you are writing for a publication, check which guide it follows before trusting any converter, this one included.

Multiple lines, and what not to paste

Each line is converted independently, so a column of column names or a list of feature flags comes back in the same order with blank lines intact. Nothing leaves your browser, which matters when the list you are renaming is a production schema.

Need a URL rather than an identifier? The slug generator does the kebab-case job with accent folding and length limits, which is a different problem from naming a variable. For counting rather than renaming, there is the word counter.

Frequently asked questions

How does it handle an acronym like XMLHttpRequest?

A run of capitals is kept together until the last one, which belongs to the word that follows. XMLHttpRequest becomes xml, http and request, so snake_case gives xml_http_request rather than x_m_l_http_request. The same rule turns exportToPDF into export_to_pdf and parseHTMLDocument into parse_html_document.

Why are digits split off from the letters next to them?

A block of digits is treated as its own word, so parseInt32Value becomes parse_int_32_value and user2fa becomes user_2_fa. It matches what the popular JavaScript and Python helpers do, and it round-trips — converting back to camelCase gives you the original.

Which words stay lowercase in Title Case?

Twenty-two short articles, conjunctions and prepositions — a, an, and, as, at, but, by, for, if, in, nor, of, on, or, per, so, the, to, up, via, vs and yet — unless they are the first or last word. That follows AP style; Chicago capitalises some of the same words, so check which one your publication uses.

Does it convert several lines at once?

Yes. Each line is converted on its own and blank lines stay where they are, so a column pasted out of a spreadsheet or a list of column names comes back in the same order. A line break is never treated as a word separator.

Can it convert back to the original casing?

Only if the original casing is one the tool can rebuild. Everything is reduced to lowercase words first, so an acronym loses its capitals — XMLHttpRequest converted to snake_case and back to PascalCase returns XmlHttpRequest. When capitalisation carries meaning, keep the original and convert a copy.

Related tools

Updated