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
| Style | Example | Where It's Used |
|---|---|---|
| camelCase | firstName | JavaScript/Java variable names |
| snake_case | first_name | Python variables, database columns |
| PascalCase | FirstName | Class names in many languages |
| kebab-case | first-name | URLs, HTML/CSS attributes |
| Title Case | First Name | Headings, titles |
| Sentence case | First name | Regular prose |
Why Programming Languages Care So Much
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_namenext touserEmailmakes 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-Usand/about-usas 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 →