camelCase, snake_case, and Title Case aren't interchangeable style preferences — each one is the expected convention in a specific context, and using the wrong one stands out immediately to anyone familiar with that context.

The Common Case Styles

StyleExampleWhere It's Used
camelCasefirstNameJavaScript/Java variable names
snake_casefirst_namePython variables, database columns
PascalCaseFirstNameClass names in many languages
kebab-casefirst-nameURLs, HTML/CSS attributes
Title CaseFirst NameHeadings, titles
Sentence caseFirst nameRegular prose

Why Programming Languages Care So Much

Convention, not preference: most programming style guides specify a case convention for variables, functions, and classes — following it isn't optional style, it's what makes code readable to other developers who expect that convention in that language.

Title Case Has Real Rules

Proper title case capitalizes major words but typically lowercases short articles, conjunctions, and prepositions ("a," "the," "and," "of") unless they're the first or last word — "The Lord of the Rings," not "The Lord Of The Rings." Getting this wrong is a common, noticeable mistake in headlines and titles.

Where Kebab-Case Matters

URLs and HTML attributes conventionally use kebab-case rather than camelCase or spaces — "my-page-title" rather than "myPageTitle" or "my page title," partly because spaces and certain characters aren't safe in URLs without encoding.

Worked Example: One Phrase, Six Cases

Here's the phrase "total order amount" converted to each style, and where you'd actually use it:

  • camelCase — totalOrderAmount — a JavaScript variable.
  • snake_case — total_order_amount — a Python variable or database column.
  • PascalCase — TotalOrderAmount — a class or type name.
  • kebab-case — total-order-amount — a URL slug or CSS class.
  • SCREAMING_SNAKE_CASE — TOTAL_ORDER_AMOUNT — a constant that never changes.
  • Title Case — Total Order Amount — a column heading in a report.

Tricky Cases: Acronyms and Numbers

Acronyms cause the most inconsistency. Is it userID or userId? HTMLParser or HtmlParser? Style guides disagree, and many modern ones (including Google's Java style guide) treat acronyms as ordinary words — userId, HtmlParser — because it makes word boundaries easier to spot. Whatever you choose, the key is to be consistent across a whole project. Numbers are usually kept attached to the preceding word, as in address2 or address_2.

Common Mistakes to Avoid

  • Mixing conventions in one codebase. user_name next to userEmail makes code harder to scan and search.
  • Using ALL CAPS for emphasis in prose. It reads as shouting; bold or italics work better.
  • Capitalizing every word in title case, including "a," "of" and "the," when they're not the first or last word.
  • Spaces or capitals in URLs. Some servers treat /About-Us and /about-us as different pages, so lowercase kebab-case is safest.

Frequently Asked Questions

What's the difference between Title Case and Sentence case?

Title Case capitalizes the major words ("How to Write a Great Headline"). Sentence case capitalizes only the first word and proper nouns ("How to write a great headline"). Many modern websites and style guides prefer sentence case for headings because it reads more naturally.

Which case should I use for file names?

Lowercase kebab-case or snake_case is the safest choice. It avoids problems with spaces in links and with systems that treat upper- and lower-case letters differently.

Give it a go

Use our free Case Converter — camelCase, snake_case, Title Case and more

Open Case Converter →