How to use the case converter
- Type or paste into Identifier or phrase. Any style works as input:
getUserProfileURL,user_profile_url,user-profile-urlor plain words. - Read the table. It lists all 13 styles at once, so there is nothing to select.
- Copy the row you need.
What it does and when to use it
Renaming across layers is a daily chore. A database column created_at becomes createdAt in a JSON API, CREATED_AT in an environment variable and created-at in a CSS class or a URL. This tool gives every form at once, so you can paste the one you need without retyping.
The 13 outputs are camelCase, PascalCase, snake_case, CONSTANT_CASE, kebab-case, Train-Case, dot.case, path/case, flatcase, Title Case, Sentence case, lower case and UPPER CASE.
For URL slugs with accents stripped, use slugify. For changing the case of ordinary prose (sentence case, title case, alternating case), the text case converter is a better fit. To escape a converted name for a JSON or shell string, use the string escaper.
How it works
The input is first split into words with two rules:
- A lowercase letter or digit followed by a capital starts a new word:
getUser→get User. - A run of capitals followed by a capital plus a lowercase letter is split before that last capital:
XMLHttp→XML Http.
Everything that is not a Unicode letter or digit (spaces, _, -, ., /, line breaks) then acts as a separator. The words are lowercased and joined again for each style. For example, snake_case joins them with _, CONSTANT_CASE also upper-cases the result, and Train-Case capitalises each word and joins with -. It runs in your browser.
Worked examples
getUserProfileURL. The acronym at the end is split off correctly:
camelCase | getUserProfileUrl
PascalCase | GetUserProfileUrl
snake_case | get_user_profile_url
CONSTANT_CASE | GET_USER_PROFILE_URL
kebab-case | get-user-profile-url
XMLHttpRequest, the classic hard case with an acronym at the start:
camelCase | xmlHttpRequest
snake_case | xml_http_request
Title Case | Xml Http Request
Mixed separators, hello world-foo_bar, are normalised:
camelCase | helloWorldFooBar
dot.case | hello.world.foo.bar
path/case | hello/world/foo/bar
Limits and tips
- Brand capitals are lost.
iOSsplits intoiandOS, givingi_osin snake_case. Fix names like iOS, GitHub or macOS by hand. - No reserved-word check. The tool does not warn if a result clashes with a keyword (
class,default) or starts with a digit, which most languages forbid.
Frequently asked questions
Why does URL become Url in camelCase?
How are numbers handled?
Can I convert a whole list of names at once?
Are accented letters kept?
Which style does each language use?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.