Case Converter

Convert identifiers between camelCase, snake_case, kebab-case and more.

Runs in your browser Instant No sign-up
Text
Converted

Paste, type or drop a file — output appears as you type.

Waiting for input
Processed locally · nothing is uploadedProcessed locally

How to use the Case Converter

  1. Paste an identifier, a phrase, or a list with one item per line.
  2. Leave Convert to on Show all to preview every style for the first line.
  3. Pick a specific case to convert every line at once, then Copy or Download the result.

With Show all, the input XMLHttpRequest user_id v2 produces:

camelCase      xmlHttpRequestUserIdV2
PascalCase     XmlHttpRequestUserIdV2
snake_case     xml_http_request_user_id_v2
CONSTANT_CASE  XML_HTTP_REQUEST_USER_ID_V2
kebab-case     xml-http-request-user-id-v2
dot.case       xml.http.request.user.id.v2
Title Case     Xml Http Request User Id V2
Sentence case  Xml http request user id v2
lower case     xmlhttprequest user_id v2
UPPER CASE     XMLHTTPREQUEST USER_ID V2

If you paste several lines with Show all selected, only the first line is previewed and the status bar reminds you to pick a case.

When to use it

  • Mapping API fields. A snake_case backend and a camelCase frontend need the same names in two styles. Paste the column list, pick camelCase, and copy the result: first_name, lastName, EMAIL_ADDRESS and phone-number become firstName, lastName, emailAddress and phoneNumber.
  • Configuration. Turn labels into environment variable names with CONSTANT_CASE, or into CSS classes and URL slugs with kebab-case.
  • Checking a rename. Paste the old and new lists into Text Diff to review every line before you commit it.

The cases

Case Example Typical use
camelCase userId JavaScript/Java variables, JSON keys
PascalCase UserId Classes, types, React components
snake_case user_id Python, Ruby, SQL columns
CONSTANT_CASE USER_ID Constants, environment variables
kebab-case user-id URLs, CSS classes, CLI flags
dot.case user.id Config keys, i18n message IDs
Title Case User Id Headings, labels
Sentence case User id UI text
lower case / UPPER CASE user_id / USER_ID Change letters only

lower case and UPPER CASE change the letters and keep everything else, including spaces and underscores. All other cases rebuild the text from its words.

How words are detected

  • Separators: spaces, _, -, . and other punctuation.
  • Case changes: userId becomes user + Id.
  • Acronyms: HTTPServerError becomes HTTP + Server + Error.
  • Digits stay attached to their word: http2Server becomes http2 + Server, and v2 stays one word.

Converting a list with snake_case:

userId            →  user_id
HTTPServerError   →  http_server_error
my-var name       →  my_var_name
first name 2      →  first_name_2

Tips

  • Renaming JSON keys: generate typed models with snake_case fields directly in JSON to Pydantic, or camelCase interfaces in JSON to TypeScript.
  • Bulk search and replace: for pattern-based renames, use the Regex Tester in Replace mode.

In code

// lodash
_.camelCase('user_id');   // 'userId'
_.snakeCase('userId');    // 'user_id'
_.kebabCase('User Id');   // 'user-id'
import re
def snake(s): return re.sub(r'(?<=[a-z0-9])(?=[A-Z])', '_', s).lower()

Frequently asked questions

How does it split identifiers into words?

It breaks at spaces, underscores, hyphens, dots and other punctuation, and at case changes: userId becomes user and Id, and a run of capitals followed by a lowercase word splits before the last capital, so XMLHttpRequest becomes XML, Http and Request.

Why does XMLHttpRequest become XmlHttpRequest in PascalCase?

Each word is capitalized and the rest of it lowercased, so acronyms are normalized to Xml. This matches common style guides such as Google's Java and TypeScript guides. Adjust by hand if your codebase keeps acronyms in capitals.

Can I convert many identifiers at once?

Yes. Choose a case in Convert to and paste one identifier or phrase per line. Every non-empty line is converted and blank lines are kept.

Are non-English letters supported?

Yes. Words are detected with Unicode letter and number classes, so accented and non-Latin letters stay part of words.

Is my text uploaded?

No. Conversion runs in your browser. Nothing is uploaded.

Last updated