Developer Case Converter
camelCase
Output appears herePascalCase
Output appears heresnake_case
Output appears herekebab-case
Output appears hereCONSTANT_CASE
Output appears heredot.case
Output appears hereTrain-Case
Output appears hereFound this tool useful? Share it:
What this developer case converter does
It converts a variable, function or file name into seven naming conventions at once: camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, dot.case and Train-Case. It understands names that are already in a convention, so getUserName, user_first-name and plain words like user first name all work as input. Paste a list with one name per line and every line is converted separately.
How to use it
- Paste one name or a list of names, one per line.
- Read the seven results, which update as you type.
- Use the copy button on the format you need.
The seven formats
| Format | Example | Commonly used for |
|---|---|---|
| camelCase | getUserName | Variables and functions in JavaScript and Java, JSON keys. |
| PascalCase | GetUserName | Class and type names in languages such as C#, TypeScript and Java, and exported names in Go. |
| snake_case | get_user_name | Variables and functions in Python, Ruby and Rust, and database column names. |
| kebab-case | get-user-name | CSS classes, URL slugs and file names. |
| CONSTANT_CASE | GET_USER_NAME | Constants and environment variables. |
| dot.case | get.user.name | Configuration keys and property paths. |
| Train-Case | Get-User-Name | HTTP header names such as Content-Type. |
These are common conventions, not rules. Your team or framework may prefer something different.
How a name is split into words
Every format is built from the same list of words. A new word starts at any run of characters that is not a letter or digit (spaces, underscores, hyphens, dots, slashes), and wherever the case changes from lowercase or a digit to uppercase. A run of capitals followed by a capitalized word is split before that word, which is how acronyms inside a name are separated.
| Input | snake_case | camelCase | CONSTANT_CASE |
|---|---|---|---|
| getUserName | get_user_name | getUserName | GET_USER_NAME |
| XMLHttpRequest | xml_http_request | xmlHttpRequest | XML_HTTP_REQUEST |
| HTML5Parser | html5_parser | html5Parser | HTML5_PARSER |
| userID | user_id | userId | USER_ID |
| user_first-name | user_first_name | userFirstName | USER_FIRST_NAME |
| API response v2 | api_response_v2 | apiResponseV2 | API_RESPONSE_V2 |
| don't stop me now | dont_stop_me_now | dontStopMeNow | DONT_STOP_ME_NOW |
| order #42 / total | order_42_total | order42Total | ORDER_42_TOTAL |
Converting several names at once
getUserName XMLHttpRequest user_first-name
get-user-name xml-http-request user-first-name
Blank lines stay blank, so the output lines up with your input.
Limits
- Acronyms become ordinary words in camelCase and PascalCase: XMLHttpRequest becomes xmlHttpRequest, not XMLHttpRequest. Some style guides keep acronyms capitalized, so adjust those by hand.
- Names with a capital inside a brand are split there. iOS becomes i_os in snake_case, and iOS app version becomes iOsAppVersion in camelCase.
- Apostrophes are removed, so don't becomes dont. Other punctuation and emoji act as word breaks and are dropped. Letters from other alphabets, including accented letters, are kept.
- The result is not checked against a language. A name that starts with a digit (2fa code becomes 2faCode) or a reserved word may not be valid as an identifier.
- Only the text you paste is converted. It does not parse or rewrite code.
Single-format converters
If you only need one format, each has its own page with the same conversion rules.
- camelCase - for variables and functions
- PascalCase - for class and type names
- snake_case - for Python, Ruby and database columns
- kebab-case - for CSS classes, URLs and file names
- CONSTANT_CASE - for constants and environment variables
- Slugify Generator - turn titles into URL slugs, with accents transliterated