Programmers, writers and marketers all use different “cases” – ways of capitalising and joining words. Using the right one makes code consistent, headlines look professional and URLs clean. Here is every common case with examples and where it belongs.
Page Contents
Programming cases
| Case | Example | Common use |
|---|---|---|
| camelCase | userFirstName | Variables and functions in JavaScript, Java, Kotlin, Swift |
| PascalCase | UserFirstName | Classes and types; React components; C# methods |
| snake_case | user_first_name | Python variables and functions, database columns, Ruby |
| kebab-case | user-first-name | URLs, CSS classes, file names, HTML attributes |
| CONSTANT_CASE | USER_FIRST_NAME | Constants and environment variables |
Language conventions
- JavaScript / TypeScript: camelCase for variables, PascalCase for classes and components.
- Kotlin / Java: camelCase for functions and properties, PascalCase for classes, CONSTANT_CASE for constants. JSON keys from APIs are often snake_case – see JSON to Kotlin.
- Python: snake_case for functions and variables (PEP 8), PascalCase for classes.
- CSS: kebab-case class names.
Writing cases
| Case | Example | Common use |
|---|---|---|
| Sentence case | How to make a QR code for free | Body text, many modern headlines and UI buttons |
| Title Case | How to Make a QR Code for Free | Book titles, many blog and news headlines |
| UPPER CASE | HOW TO MAKE A QR CODE | Short labels and emphasis – avoid for long text |
| lower case | how to make a qr code | Tags, some brand styles |
Title Case rules
Most style guides capitalise major words and keep short articles, conjunctions and prepositions lowercase (“a”, “and”, “of”, “to”, “for”) – except as the first or last word. Style guides (AP, Chicago, APA) differ slightly in details.
Cases for the web
- URLs: lowercase kebab-case – see what is a URL slug and our Slug Generator.
- Hashtags: CamelCase (#SmallBusinessTips) for readability and accessibility – see how to use hashtags.
- Email subject lines: sentence case usually reads as more personal; avoid ALL CAPS – see subject line tips.
Fixing text typed in the wrong case
Caps Lock accidents, shouting headlines and copied database columns are easy to fix: paste the text into the Case Converter and pick the case you need.
FAQ
What is the difference between camelCase and PascalCase?
camelCase starts with a lowercase letter (userName); PascalCase starts with a capital (UserName).
When should I use snake_case?
In Python code, database column names and many APIs.
What is kebab-case?
Words in lowercase joined by hyphens, like user-first-name. It is used in URLs and CSS.
Should headlines be Title Case or Sentence case?
Either can be correct. Choose one style and use it consistently.
What is CONSTANT_CASE?
Uppercase words joined by underscores, used for constants and environment variables.
Need a website or app for your business? Talk to Techpass Master – we design and build websites and apps for clients worldwide.
