Case converter
Paste text or identifiers and see them in every common case at once. Click any result to copy it.
This tool runs in your browser. We never send what you type or paste to a server.
Where each case is used
- camelCase: JavaScript and Java variables and functions.
- PascalCase: class and component names.
- snake_case: Python, Ruby and database columns.
- CONSTANT_CASE: constants and environment variables.
- kebab-case: URLs, CSS classes and file names.
- Title Case: headings in American English style.
How words are detected
The converter splits on spaces, hyphens, underscores, dots and case changes, so getHTTPResponse_code becomes the words "get", "HTTP", "Response" and "code" before being rejoined.
Example
user account id
camelCase userAccountId
PascalCase UserAccountId
snake_case user_account_id
CONSTANT_CASE USER_ACCOUNT_ID
kebab-case user-account-id
It also reads the other direction: paste userAccountId or USER_ACCOUNT_ID and every other style is shown.
Worked examples
Input camelCase snake_case Title Case
XMLHttpRequest xmlHttpRequest xml_http_request XML Http Request
user_ID userId user_id User ID
version2Update version2Update version2_update Version2 Update
HELLO WORLD helloWorld hello_world Hello World
A run of capitals followed by a capitalised word is split before the last capital, so XMLHttp becomes "XML" and "Http". Digits stay attached to the word before them. In Title Case and Sentence case, words of two or more capitals (XML, ID) are kept as they are, while small words such as "of", "the" and "and" stay lower case unless they come first: the lord of the rings gives The Lord of the Rings.
Gotchas
- Acronyms do not survive camelCase:
XMLHttpRequestbecomesxmlHttpRequestandXmlHttpRequest, because a lower-case boundary is all that separates words. Style guides disagree here: Google's Java style writesXmlHttpRequest, while .NET keeps two-letter acronyms in capitals (IOStream). Fix such names by hand after converting. - Mixed-case brand names such as
iOSoreBayare split at the case change, givingi_os. Type them in lower case or as you want the words split. - Apostrophes are dropped in identifier styles rather than splitting the word:
don't stopbecomesdont_stopanddontStop. - Upper-casing can change length: German ß becomes SS, so
Straßein CONSTANT_CASE isSTRASSE. Conversions here are not locale-aware, so Turkish dotted and dotless i follow the default rules. - Renaming is not just text: changing a JSON key, database column or CSS class name breaks everything that uses the old name. Search the codebase and keep an alias or migration.
Converting case in code
Python: there is no built-in camelCase or snake_case function, but two substitutions cover most identifiers. Beware str.title(), which capitalises after every apostrophe.
def snake(s):
s = re.sub(r'([A-Z]+)([A-Z][a-z])', r'\1_\2', s) # HTTPResponse -> HTTP_Response
s = re.sub(r'([a-z0-9])([A-Z])', r'\1_\2', s) # userId -> user_Id
return re.sub(r'[^A-Za-z0-9]+', '_', s).strip('_').lower()
print(snake('getHTTPResponse_code')) # → get_http_response_code
print(''.join(w.title() for w in 'user_account_id'.split('_'))) # → UserAccountId
print("don't stop".title()) # → Don'T Stop str.title() starts a word after every non-letter
print('ß'.upper(), 'İ'.lower() == 'i') # → SS False case mapping can change length
JavaScript: toLowerCase() ignores the user's language; pass a locale to toLocaleLowerCase() when it matters.
const kebab = (s) => s.replace(/([a-z0-9])([A-Z])/g, '$1-$2').replace(/[\s_]+/g, '-').toLowerCase();
const camel = (s) => s.toLowerCase().replace(/[-_\s]+(.)/g, (_, c) => c.toUpperCase());
console.log(kebab('backgroundColor')); // → background-color
console.log(camel('user-account-id')); // → userAccountId
console.log('TITLE'.toLowerCase(), 'TITLE'.toLocaleLowerCase('tr')); // → title tıtle Turkish has a dotless ı
Shell: tr handles plain ASCII; GNU sed can upper-case a captured letter.
echo 'user account id' | tr 'a-z ' 'A-Z_' # → USER_ACCOUNT_ID
echo 'userAccountId' | sed -E 's/([a-z0-9])([A-Z])/\1_\2/g' | tr 'A-Z' 'a-z' # → user_account_id
echo 'user_account_id' | sed -E 's/_([a-z])/\U\1/g' # → userAccountId \U is a GNU sed extension
PowerShell: ToTitleCase capitalises every word, including "of" and "the", and leaves words already in capitals unchanged.
$ti = (Get-Culture).TextInfo
$ti.ToTitleCase('the lord of the rings') # → The Lord Of The Rings no small-word rules
$ti.ToTitleCase('NASA LAUNCH') # → NASA LAUNCH words in capitals are left alone
$ti.ToTitleCase('NASA LAUNCH'.ToLower()) # → Nasa Launch
'user_account_id' -replace '_', '-' # → user-account-idQuestions
What is the difference between camelCase and PascalCase?
camelCase starts with a lowercase letter (myValue); PascalCase starts with a capital (MyValue).
Does it work on multiple lines?
Yes. Each line is converted separately.
Can it fix text typed in ALL CAPS?
Yes. A line with no lower-case letters is treated as shouting and converted, so Title Case and Sentence case give a normal result.
Which case should I use for JSON keys?
Follow the API or codebase you are working with. JavaScript and many public APIs use camelCase, while Python, Ruby and APIs designed around SQL tables often use snake_case. What matters most is using one style consistently across an API.
Which case should I use for URLs and file names?
kebab-case in lower case. Hyphens are read as word separators by search engines, lower case avoids duplicate URLs on case-sensitive servers, and spaces would have to be percent-encoded. The slug generator also removes accents and punctuation.
Is Title Case the same in British and American English?
No. American publications usually capitalise every major word in headings, while British style guides often prefer sentence case, capitalising only the first word and proper nouns. Use the Sentence case result for that style.