Skip to content

Case Converter - camelCase, snake_case & More

camelCase
camelCase
PascalCase
PascalCase
snake_case
snake_case
kebab-case
kebab-case
CONSTANT_CASE
CONSTANT_CASE
dot.case
dot.case
UPPER CASE
UPPER CASE
lower case
lower case
Title Case
Title Case
Sentence case
Sentence case

Convert Between Naming Conventions

Paste an identifier, a phrase or a whole list, one item per line, and all ten formats appear below as you type. It is quickest when you are moving names between layers that use different conventions: a user_id column in Postgres, a userId property in JavaScript, a USER_ID environment variable and a user-id CSS class or URL slug.

Example

The input XMLHttpRequest gives:

  • camelCase: xmlHttpRequest
  • PascalCase: XmlHttpRequest
  • snake_case: xml_http_request
  • kebab-case: xml-http-request
  • CONSTANT_CASE: XML_HTTP_REQUEST
  • dot.case: xml.http.request

Note that PascalCase gives XmlHttpRequest, not the original XMLHttpRequest: each word is capitalised and the rest lower-cased, which is what most style guides (including Microsoft's .NET guidelines for acronyms longer than two letters) recommend.

Which Convention Goes Where

  • camelCase: JavaScript and Java variables and functions, JSON keys in most JavaScript APIs.
  • PascalCase: classes and types in most languages, React components, C# methods and properties.
  • snake_case: Python and Ruby variables and functions, Rust functions, SQL table and column names.
  • kebab-case: CSS classes, URL slugs, HTML attributes, command-line flags, npm package names.
  • CONSTANT_CASE: constants and environment variables such as DATABASE_URL.
  • dot.case: config and translation keys such as app.header.title.

Edge Cases

A digit followed by a capital starts a new word, so user_id2FA becomes user-id2-fa. Accented and non-Latin letters are handled, so Über Größe becomes über_größe. Title Case capitalises every word, including "of" and "the", and Sentence case lower-cases proper nouns, so check those two by hand before publishing a heading.

Related Tools

Frequently Asked Questions

Which formats does it produce?
Ten at once: camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, dot.case, UPPER CASE, lower case, Title Case and Sentence case. Each has its own copy button.
How does it split an identifier into words?
It breaks at spaces, underscores, hyphens, dots and other punctuation, and at a change from lower case or a digit to upper case. A run of capitals followed by a lower-case letter is treated as an acronym, so XMLHttpRequest becomes xml_http_request and user-profile_page title becomes userProfilePageTitle.
Why did don't become don_t?
Apostrophes count as word separators in the identifier formats, because they are not allowed in variable names. Title Case and Sentence case keep them, so don't stays don't there.
Why does Title Case change NASA to Nasa?
Title Case and Sentence case lower-case everything first and then capitalise the first letter of each word (or each sentence), so acronyms and names like iPhone are not preserved, and small words like of and the are capitalised too. Fix those by hand, or keep them out of the input.
Does it handle multi-line text?
Yes. Each line is converted on its own and line breaks are kept, so you can paste a column of database field names and copy them all back in camelCase.