UPPERCASE, camelCase, snake_case & Slugs: When to Use Each
A practical guide to text case conventions: when to use Title Case in headings, camelCase in JavaScript, snake_case in databases and kebab-case in URLs.
Every text case exists for a reason. Use the wrong one and your headline looks shouty, your code won't compile, or your URL gets penalised by Google.
The Cases at a Glance
- UPPERCASE — emphasis, acronyms, error codes. Avoid in body text — research shows all-caps reduces reading speed by ~10%.
- lowercase — informal voice, code identifiers in some styles, email addresses.
- Title Case — headlines, book titles, navigation labels.
- Sentence case — buttons, UI microcopy, modern editorial style.
- camelCase — JavaScript / Java / Swift variables and functions.
- PascalCase — class names, React components, .NET methods.
- snake_case — Python variables, SQL columns, environment variables (UPPER_SNAKE).
- kebab-case — URL slugs, CSS classes, HTML attributes.
Title Case Rules That Trip People Up
Capitalise nouns, verbs, adjectives, adverbs, and the first and last word. Lowercase articles (a, an, the), short prepositions (in, on, of, to) and conjunctions (and, but, or) — unless they appear at the start or end. AP style additionally lowercases prepositions of 3 letters or fewer; Chicago capitalises prepositions of 4 letters or more (with, from, over). Pick one and stick with it.
URL Slugs: Hyphens, Not Underscores
Google explicitly treats hyphens as word separators (find-and-replace = three words) and underscores as joiners (find_and_replace = one token). For SEO, always use hyphens, lowercase, and no diacritics.
Programming Conventions Cheat Sheet
- JavaScript / TypeScript →
camelCasefor vars,PascalCasefor classes/components,UPPER_SNAKEfor constants. - Python →
snake_casefor vars/functions,PascalCasefor classes,UPPER_SNAKEfor constants. - SQL →
snake_casefor tables and columns,UPPERfor keywords. - CSS →
kebab-casefor classes and custom properties.
Try it now
Open the Case Converter →