One identifier, six spellings
Convert identifier case
Code style is mostly about where the word breaks sit. This page finds those breaks and prints the same words in the forms languages usually want.
Separators are spaces, underscores, hyphens, and other characters outside letters and digits. A lower-case letter or digit followed by an upper-case letter is also a break, so userId becomes two words. A run of capitals before a normal word breaks too: getHTTPResponse becomes get, http, response. Each word is then lower-cased and rejoined. camelCase leaves the first word lower. PascalCase capitalizes every word. snake_case and kebab-case join with _ or -. CONSTANT_CASE is the snake form in upper case. Title Case capitalizes each word and joins with spaces.
The identifier is converted in this tab and is not saved.
This tool runs in your browser. Turn on JavaScript to use it.
getHTTPResponse, split on the capital run
The acronym does not stay in capitals. The page treats HTTP as a word of its own, then recases that word for the target style.
- Input
- getHTTPResponse
- camelCase
- getHttpResponse
- snake_case
- get_http_response
How to use it
- 1Paste one identifier, or a short phrase.
- 2Read the six outputs. Copy the one your file uses.
- 3If a break is wrong, add a space or an underscore in the input and convert again.
Good to know
- Digits stay with the word they were already in: user2Id becomes user2 and id.
- Punctuation other than the separators is dropped, because it is not an identifier character.
- The page does not know English plurals. It will not turn mice into mouse.
Questions
Why did API become api?
Every word is lower-cased before the target style is applied. CONSTANT_CASE is the form that turns it back to API, as part of API_RESPONSE if that was the rest of the name.
Can I convert a whole file?
No. Paste one name. A file would need a parser, and this page does not parse code.
What about kebab-case in a URL?
The kebab line is the one to copy. Encode it afterward if it still contains a space you left in on purpose.
Related tools
- Make a URL slug
A slug is the readable tail of a URL. This page lowercases the text, removes accents, and joins the remaining words with hyphens.
- Sort, trim, and count lines
Lists in a text box are awkward to clean by hand. This page trims, filters, sorts, or reverses the lines, and always shows the counts.
- Test a JavaScript regular expression
Regular expressions in JavaScript are not the same as PCRE or .NET. This page uses the RegExp your browser already ships, so a match here is a match in frontend code.