All posts

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.

June 15, 2026 5 min read

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 → camelCase for vars, PascalCase for classes/components, UPPER_SNAKE for constants.
  • Python → snake_case for vars/functions, PascalCase for classes, UPPER_SNAKE for constants.
  • SQL → snake_case for tables and columns, UPPER for keywords.
  • CSS → kebab-case for classes and custom properties.

Frequently Asked Questions

Related reads