EthicalFusion

Code Case Converter

Convert any phrase to camelCase, PascalCase, snake_case, kebab-case and CONSTANT_CASE.

Was this tool helpful?

Thanks for the feedback!

The Code Case Converter takes a phrase such as "user profile settings" and prints it in seven naming conventions at once: camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, dot.case and path/case. Programmers use it to name variables, database columns, CSS classes and environment variables consistently without retyping the same words seven ways.

Output for the example phrase

camelCase:    userProfileSettings
PascalCase:   UserProfileSettings
snake_case:   user_profile_settings
kebab-case:   user-profile-settings
CONSTANT:     USER_PROFILE_SETTINGS
dot.case:     user.profile.settings
path/case:    user/profile/settings

All seven lines appear in one result box. The Copy button copies the whole block, so select just the line you need if you want a single form.

How your input is split into words

  1. Every character that is not an English letter or a digit, such as a space, hyphen, underscore, dot or slash, is treated as a break between words.
  2. Each word is converted to lowercase.
  3. The words are joined with the separator and capitalisation each convention requires.

Because hyphens and underscores count as breaks, converting between existing styles works: "first-name_field 2" becomes firstNameField2, first_name_field_2 and FIRST_NAME_FIELD_2. Digits survive as their own words.

Two inputs that give surprising results

Text that is already camelCase

Capital letters inside a word are not treated as word breaks. "userProfile" is seen as one word, so every output reads "userprofile" or "USERPROFILE". Likewise "getHTTPResponse code" becomes gethttpresponseCode. Type the words with spaces ("get http response code") to get getHttpResponseCode.

Accented letters

Letters outside A to Z are treated as separators and dropped, so "Café menu" comes out as cafMenu. Run the phrase through the accent remover first to get cafeMenu. Identifiers are safest in plain ASCII anyway, even where a language technically allows Unicode names.

Which convention to use where

ConventionTypical use
camelCaseJavaScript and Java variables and functions, many JSON API fields
PascalCaseClass names in most languages, React components, C# methods
snake_casePython functions and variables (PEP 8), Ruby, SQL column names
kebab-caseCSS classes, URL paths, file names, command-line options
CONSTANT_CASEConstants and environment variables such as DATABASE_URL
dot.caseConfiguration keys and translation keys, e.g. app.title
path/caseFolder paths, route segments and namespaces

The strongest rule is consistency with the codebase you are working in. Python's PEP 8 style guide asks for snake_case functions, CapWords (PascalCase) classes and UPPER_CASE constants, while Java uses camelCase methods with PascalCase classes. When a JavaScript front end talks to a Python back end, you often need the same field name in both camelCase and snake_case, which is exactly the situation this converter speeds up.

For URLs, use a slug tool instead

kebab-case here is aimed at identifiers. A page URL also needs accented letters converted to plain ones rather than dropped, which the slug generator does line by line for titles.

Frequently asked questions

How do I convert text to camelCase?
Type the words separated by spaces, hyphens or underscores and press Convert cases. The first line of the result is the camelCase version.
Why does userProfile come out as userprofile?
Capital letters inside a word are not treated as word boundaries. Put a space between the words, as in "user profile", and the converter will split them.
Can I convert snake_case to camelCase with this tool?
Yes. Underscores and hyphens count as word breaks, so user_profile_settings becomes userProfileSettings.
What is the difference between PascalCase and camelCase?
PascalCase capitalises every word including the first (UserProfile), while camelCase keeps the first word lowercase (userProfile).
Why did the accented letter disappear from my identifier?
Only English letters and digits are kept; anything else is treated as a separator. Remove accents first so é becomes e.

Related tools

Embed this tool on your site

Paste it into any blog or website. Free, with a credit link.