Case Converter
Convert text to camelCase, snake_case, kebab-case, Title Case and more.
How to use
- Type or paste your text into the Your text box. It can be a phrase, a variable name or a whole sentence.
- Press one of the nine format buttons. The result appears in the result panel straight away. If the box is empty the tool asks you to type something first.
- Press another button to see the same text in a different format. The input is never changed, so you can try every format in turn.
- Press Copy result to put the result on the clipboard, or Clear to empty the box and start again.
Worked example
Take the input parse HTTPServer_response-time v2. The tool gives these results:
| Button | Result |
|---|---|
| camelCase | parseHttpServerResponseTimeV2 |
| PascalCase | ParseHttpServerResponseTimeV2 |
| snake_case | parse_http_server_response_time_v2 |
| kebab-case | parse-http-server-response-time-v2 |
| CONSTANT_CASE | PARSE_HTTP_SERVER_RESPONSE_TIME_V2 |
| Title Case | Parse Httpserver_response-time V2 |
| Sentence case | Parse httpserver_response-time v2 |
The first five rows are identifier formats. They find the words parse, HTTP, Server, response, time and v2, then join them. The last two rows work on the text as written, so the underscore and hyphen are left alone and HTTPServer becomes one word, Httpserver.
How it works
For identifier formats, the text is split into words in three steps. A boundary is inserted where a lower-case letter or digit is followed by an upper-case letter (fooBar gives foo and Bar). A second boundary is inserted between a run of capitals and a following capitalised word (HTTPServer gives HTTP and Server). Finally, anything that is not a letter or a digit is treated as a separator and dropped. Each word is then lower-cased, capitalised or upper-cased and joined with nothing, an underscore or a hyphen.
These conventions come from programming style guides rather than from one standard. camelCase is common for JavaScript variables, PascalCase for class and type names, snake_case for Python and Ruby names and database columns, kebab-case for CSS classes and URL slugs, and CONSTANT_CASE for constants and environment variables. The MDN JavaScript code style guide shows the JavaScript naming habits.
Common mistakes and edge cases
- Accents and non-Latin letters. The word splitter only keeps the letters A to Z and the digits 0 to 9. A word such as
caféloses its accented letter in the identifier formats and splits intocaf. Use Title, Sentence, UPPER or lower case for text that has accents. - Apostrophes split words.
don't stopbecomesdonTStopin camelCase, because the apostrophe counts as a separator. Remove the apostrophe first if you wantdontStop. - Title Case is not a style guide. Every word starts with a capital, including small words such as "of" and "the". Editors who follow AP or Chicago rules will need to fix those by hand.
- Sentence case capitalises the first letter after a full stop, exclamation mark or question mark. An abbreviation such as "e.g." followed by a space can trigger an unwanted capital.
- Acronyms are flattened.
HTTPServerbecomesHttpServerin camelCase and PascalCase. That matches many style guides, but not all of them.
Frequently asked questions
Does the tool keep my text?
No. The conversion runs in your browser and nothing is uploaded or stored. Closing the tab discards the text.
What is the difference between camelCase and PascalCase?
Only the first letter. camelCase starts with a lower-case letter (userName) and PascalCase starts with a capital (UserName).
Which case should I use for URLs?
Lower-case kebab-case is the usual choice for page paths, because hyphens are easy to read and URL paths are often case-sensitive. Google's documentation on URL structure recommends hyphens over underscores to separate words.
Why did my numbers move?
Digits stay attached to the letters before them, so v2 stays one word. A digit followed by a capital letter starts a new word, so 2Fast splits into 2 and Fast.
Can I convert many lines at once?
The identifier formats treat line breaks as separators and join everything into one name. For a list of names, convert one line at a time.
Related tools
- Word & Character Counter to check the length of the text you are editing.
- Regex Tester for find-and-replace patterns that change many names at once.
- HTML Entity Encoder and Decoder for text that contains accents or markup characters.
- URL Parser to see how a URL splits into its parts.