Code Case Converter

Paste one identifier or phrase and get every common programming case style back at once.

How to use

  1. Paste an identifier or short phrase (from camelCase, snake_case, kebab-case, plain words, or any mix), or a whole list, one per line: each line is converted on its own.
  2. Read the six results: camelCase, PascalCase, snake_case, CONSTANT_CASE, kebab-case and dot.case, computed together from the same word boundaries. Each row says where that style is conventionally used, if you are not sure which one you need.
  3. Press Copy on a row (Copy all for a list, one per line).
  4. Load sample inserts a worked example; Clear empties the box.

One phrase, every case style at once

Programming languages and style guides disagree on how to write a multi-word name: JavaScript variables are camelCase, classes are PascalCase, Python and database columns are snake_case, environment variables and constants are CONSTANT_CASE, URLs and CSS classes are kebab-case, and config keys sometimes use dot.case. Converting between them by hand is mechanical and easy to get subtly wrong around acronyms and numbers; this tool does the tokenising once and shows every style at the same time.

Example

The phrase userFirstName becomes:

userFirstName
UserFirstName
user_first_name
USER_FIRST_NAME
user-first-name
user.first.name

Reading the result

Edge cases and common errors

Do the same thing in code

// lodash
_.camelCase('user_first_name');   // 'userFirstName'
_.snakeCase('userFirstName');     // 'user_first_name'
_.kebabCase('userFirstName');     // 'user-first-name'

# Python
"user_first_name".title().replace("_", "")  # crude PascalCase, no acronym handling

Most languages' standard libraries do not include a full case converter: lodash (JavaScript) is the closest widely-used equivalent, and even it does not handle every acronym case this tool does.

Code Case Converter FAQ

How does it know where one word ends and the next begins?

It looks for the boundaries every common style already marks: an underscore, hyphen, dot or space, and (for already-camelCased or PascalCased input) a lowercase letter followed by an uppercase one. Acronym runs are handled too: XMLHttpRequest tokenises as XML, Http, Request, not one letter at a time.

Is this the same as the Title Case Converter?

No. The Title Case Converter capitalises prose headlines by a style guide's rules (which small words like "a" or "of" stay lowercase). This tool tokenises a single identifier and rebuilds it in a programming case style; neither tool applies the other's rules.

What happens to acronyms and numbers?

Numbers stay attached to whichever word they touch: 2FastCars tokenises as 2, Fast, Cars, so it converts as expected. Mixed brand-style casing like iOS has no reliable rule to detect automatically: iOS9Update tokenises as i, OS9, Update, which is close but not perfect; check the result before using it verbatim.

Does it convert a whole file, or one identifier at a time?

A list, one identifier or phrase per line: each line is converted on its own and the results stay one per line, so a column of database field names comes back as a column of camelCase names. Blank lines and lines with no letters or digits are skipped. It does not rewrite identifiers inside source code, though: paste the names themselves, not a whole file of code.

Runs entirely in your browser: this page is a static file with no server behind it, so nothing you paste can be uploaded. Last reviewed by Parthesh Gupta.