DEV Community

Sumit Kumar
Sumit Kumar

Posted on

Case Converter Guide: camelCase, snake_case, Title Case and When to Use Each

I'm Sumit Kumar, founder of TooliFyra. If you write code, content or even spreadsheets, you've retyped something because it was in the wrong case. "user profile id" needs to become userProfileId in JavaScript, user_profile_id in Python and user-profile-id in a URL. Doing this by hand is slow and easy to get wrong, so here's a quick guide to the formats and a tool that handles them.

The 11 formats and what they're for

Format Example Typical use
UPPERCASE USER PROFILE ID Headings, emphasis
lowercase user profile id Normalising text, emails
Title Case User Profile Id Headlines, titles
Sentence case User profile id Body copy, UI labels
camelCase userProfileId JavaScript, Java variables
PascalCase UserProfileId Class names, React components
snake_case user_profile_id Python, database columns
kebab-case user-profile-id URLs, CSS classes
CONSTANT_CASE USER_PROFILE_ID Constants, environment variables
dot.case user.profile.id Config keys, package names
path/case user/profile/id File paths, routes

How to use the Case Converter

  1. Open the Case Converter.
  2. Type or paste your text into the input box.
  3. Click the format you want. The result appears in the output panel straight away.
  4. Click Copy to put it on your clipboard, or click another button to try a different format on the same input.

You don't need to reset anything between conversions. The same input can be turned into several formats one after another.

Smart word splitting

A good converter has to know where one word ends and the next begins. This tool splits words on spaces, hyphens, underscores and camelCase boundaries. So you can paste getUserProfile, get_user_profile or get-user-profile and convert any of them into any other format. That makes it handy when renaming variables while refactoring, or moving data between systems with different conventions, for example a JSON API in camelCase and a database in snake_case.

It also keeps punctuation inside words sensible. Apostrophes in words like "don't" and hyphens in compound words are handled so that Title Case and Sentence case don't mangle them.

Real-world scenarios

  • Developers: convert a column name list from a database schema to camelCase properties for your model class.
  • SEO and bloggers: turn a headline into a kebab-case URL slug. "10 Free Tools for Students" becomes a clean, hyphenated path.
  • Writers and editors: paste a headline typed in all caps and switch it to Title Case or Sentence case in a click.
  • Designers and developers: convert a Figma layer name into a CSS class name or a React component name.
  • Data cleaning: lowercase a list of email addresses or tags before comparing them.

Tips

  • Check Title Case on headlines. Different style guides handle short words such as "of" and "and" differently, so skim the output before publishing.
  • Pick one convention per project and stick to it. Mixed naming is the main reason code becomes hard to read.
  • Use CONSTANT_CASE only for true constants, not ordinary variables.
  • Convert in bulk. You can paste several lines at once rather than converting them one at a time.
  • Keep sensitive text out of random websites. This converter runs in your browser and makes no server calls, so what you paste isn't uploaded.

Frequently asked questions

What is the difference between camelCase and PascalCase?
camelCase starts with a lowercase letter (userName), PascalCase starts with an uppercase one (UserName).

Which case should I use for URLs?
kebab-case is the common choice because search engines treat hyphens as word separators.

Can I convert snake_case directly to camelCase?
Yes. The tool splits words on underscores, so you can paste snake_case and click camelCase.

Is there a length limit?
There's no fixed limit stated, though very large text depends on your browser's memory.

Is it free?
Yes, and no sign-up is needed.

Give it a go with the free Case Converter. For other utilities for developers and writers, visit TooliFyra.

Top comments (0)