navaja.dev / case

Case converter: camelCase, snake_case and more

Paste text or identifiers and get every naming convention at once: camelCase, PascalCase, snake_case, CONSTANT_CASE, kebab-case and more. Paste a list and each line is converted on its own.

How to convert text case

  1. Paste text or an identifier in any style: user account ID, userAccountId or USER_ACCOUNT_ID all give the same words.
  2. Read off the case you need. Every convention is listed at once, each with its own Copy button.
  3. Convert a list by pasting one name per line, for example a column of database fields to rename as JSON keys.

Naming conventions and where they're used

How words are found

Text is split at spaces, punctuation (apostrophes inside words are dropped, so don't becomes dont), _, -, . and /, at every lower-to-upper change (fooBar), and before the last capital of an acronym (HTTPResponse becomes HTTP and Response). Digits stay with the word before them, so base64Encode becomes base64_encode. Accented and non-Latin letters count as letters, so créerUnCompte becomes créer_un_compte. For a sentence, Title, Sentence, lower and UPPER case only change letters and keep your punctuation.

Changing case in code

Questions

What is the difference between camelCase and PascalCase?

Both join words without separators and capitalize each word. camelCase starts with a lowercase letter (userId), PascalCase with an uppercase one (UserId). PascalCase is also called UpperCamelCase.

How are acronyms like ID or HTTP handled?

An all-caps run is kept as one word, so parseHTTPResponse becomes parse_http_response and userID becomes user_id. In camelCase and PascalCase the acronym is written as a normal word (parseHttpResponse), which most style guides recommend.

Can I convert many names at once?

Yes. Paste one name per line and every line is converted separately, so a list of database columns becomes a list of camelCase keys you can copy in one go.

What is kebab-case used for?

URLs, CSS class names, HTML attributes, command-line flags and package names. It is called kebab-case because the words look skewered on a stick.

What is CONSTANT_CASE?

Uppercase words joined by underscores, also called SCREAMING_SNAKE_CASE. It is used for constants and environment variables, such as MAX_RETRIES or DATABASE_URL.

Is my text sent anywhere?

No. The conversion runs in your browser and nothing is uploaded or stored.