Skip to main content

Case Converter

Case Converter rewrites identifiers between camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE and nine more, in your browser. The conversion is trivial; the hard part is splitting the input into words — XMLHttpRequest is three words, user2fa is three, and a converter that gets those wrong produces output nobody wants.

Local-only
Input (one identifier per line)
0 B1 lineLn 1, Col 1
camelCase
 
PascalCase
 
snake_case
 
CONSTANT_CASE
 
kebab-case
 
Train-Case
 
dot.case
 
path/case
 
Sentence case
 
Title Case
 
lowercase
 
UPPERCASE
 
aLtErNaTiNg
 
iNVERSE
 

How does Case Converter work?

Every naming convention is the same list of words rendered differently, so converting between them is one problem — splitting the input into words — followed by a trivial join. Converters differ entirely in the first step.

Three word boundaries, in order of how often they are missed

A lower-to-upper transition is the obvious one: userName is two words. An acronym followed by a word is the one most converters get wrong: XMLHttpRequest is XML Http Request, not one word and not eight. A letter-to-digit transition is the one nobody thinks about: user2fa is user 2 fa, which is why user2fa becomes user_2_fa rather than user2fa.

Separators — space, underscore, hyphen, dot, slash — are all treated identically, which is what lets the tool accept input in any convention without being told which. You do not pick a source format, because there is nothing to pick.

The Turkish I

"I".toLocaleLowerCase() is "ı" — a dotless i — in Turkish and Azeri, not "i". That is correct for those languages and catastrophic for code: every case-insensitive comparison against an ASCII string fails, and an identifier named ID becomes something a compiler does not recognise. So casing here is locale-independent by default, with locale-aware casing available for prose, where it is the right answer.

Prose styles change capitalisation, not structure

Sentence case and Title case operate on the text rather than on its words: punctuation, spacing and existing acronyms survive. Title case keeps minor words — a, an, the, of, to and the rest — lowercase unless they are first or last, which is the rule most English style guides share even though they disagree about the list.

Acronym preservation is a genuine choice

user_id to PascalCase is UserId or UserIDdepending on your language's conventions — Go's style guide requires the second, C#'s requires the first for two-letter acronyms and the first for longer ones. Neither is wrong, so it is a toggle rather than a decision made for you.

Input

XMLHttpRequest

Converted

words        XML | Http | Request
camelCase    xmlHttpRequest
snake_case   xml_http_request
CONSTANT     XML_HTTP_REQUEST
kebab-case   xml-http-request

What options and edge cases does Case Converter support?

Styles
ParameterTypeDefaultBehaviour & edge cases
camelCasecameluserFirstNameJavaScript and Java variables and functions. First word lowercase, the rest capitalised.
PascalCasepascalUserFirstNameType names in almost every language: classes, interfaces, React components.
snake_casesnakeuser_first_namePython and Ruby identifiers, and SQL column names on Postgres.
CONSTANT_CASEconstantUSER_FIRST_NAMEEnvironment variables and compile-time constants in C, Java, Go and JavaScript.
kebab-casekebabuser-first-nameURLs, CSS custom properties and class names, npm package names. Not a legal identifier in most languages.
Train-CasetrainUser-First-NameHTTP header names — Content-Type, X-Request-Id — which are case-insensitive but conventionally written this way.
dot.casedotuser.first.nameNested configuration keys, i18n message keys, and Java package-style namespaces.
path/casepathuser/first/nameURL path segments and file paths built from a name.
Sentence casesentenceUser first nameProse. Capitalises the first letter of each sentence and leaves the rest alone, so existing acronyms survive.
Title CasetitleUser First NameHeadings. Minor words stay lowercase unless first or last.
lowercaseloweruser first nameThe whole string lowercased, punctuation and spacing untouched.
UPPERCASEupperUSER FIRST NAMEThe whole string uppercased.
aLtErNaTiNgalternatinguSeR fIrSt nAmEAlternating case, character by character.
iNVERSEinverseuSER fIRST nAMEEvery letter's case flipped.

Frequently asked questions

Why did XMLHttpRequest split into three words?

Because it is three. The rule is that an all-caps run followed by a capital and a lowercase letter ends a word at the boundary: XMLH-ttp becomes XML | Http. Without it you get either one word — xmlhttprequest — or eight, with every capital starting a new one: x_m_l_http_request. Both are wrong and both are common.

Do I need to tell it what format my input is in?

No, and there is deliberately no option for it. Every separator is treated alike and every case boundary is detected, so camelCase, snake_case, kebab-case, dot.case and plain prose all split into the same word list. Mixed input works too, which matters when you are converting a list someone assembled from three codebases.

Why is there a locale option for lowercasing?

Because "I".toLocaleLowerCase() is "ı" — a dotless i — in Turkish and Azeri. That is linguistically correct and disastrous for identifiers: an ASCII comparison against "id" fails, and code that lowercases user input to compare it against a keyword stops working for Turkish users. The option is off by default because the usual job here is code, and on for prose in those languages.

UserId or UserID?

It depends on the language. Go's style guide requires UserID and capitalises every initialism — APIURL, HTTPServer. C# and Java use UserId, capitalising only the first letter of an acronym longer than two characters. Neither is more correct; use whichever matches the code around it, which is why this is a toggle.

Can it convert a whole file of identifiers?

One per line, yes — each line is converted independently, so you can paste a column out of a schema or a config and get the whole thing back. It is not a code-aware rename: it does not know which words in a line are identifiers and which are syntax, so it converts the whole line as one name.

Is my text uploaded?

No. It is string manipulation, running in your browser. The identifiers people convert describe internal systems — table names, field names, feature flags — which is not secret exactly, and is also not something to hand to an unknown server for no reason.