If you have ever worked on a codebase with multiple people, you have probably seen the same concept written as userName, user_name, and user-name all in the same project. These are not typos — they are different naming conventions, each with its own rules, history, and appropriate context. Understanding them makes you a better developer and a more consistent writer.
Why naming conventions exist
Code and file names cannot contain spaces. When a concept naturally consists of multiple words — like "background colour" or "maximum retry count" — you need a way to join them without spaces while keeping the result readable. Naming conventions solve this problem, and different programming languages, frameworks, and communities have settled on different solutions.
Consistency within a codebase matters more than which convention you pick. A team that uses snake_case everywhere is far easier to work with than one that mixes styles inconsistently.
The main case styles explained
| Style | Example | Rule |
|---|---|---|
| UPPERCASE | BACKGROUND_COLOR | All letters capitalised |
| lowercase | backgroundcolor | All letters lowercase |
| Title Case | Background Color | First letter of each word capitalised |
| Sentence case | Background color | Only the first letter capitalised |
| camelCase | backgroundColor | First word lowercase, subsequent words capitalised |
| PascalCase | BackgroundColor | Every word starts with a capital letter |
| snake_case | background_color | Words joined by underscores, all lowercase |
| kebab-case | background-color | Words joined by hyphens, all lowercase |
camelCase
Named after the humps of a camel — the capital letters mid-word resemble a camel's silhouette. The first word is entirely lowercase; every subsequent word starts with a capital letter. No separators are used.
Where it is used:
- JavaScript and TypeScript variable and function names:
getUserData(),isLoggedIn - Java variable and method names
- JSON keys by convention
- Swift and Kotlin variables
PascalCase
Also called UpperCamelCase — identical to camelCase except the very first letter is also capitalised. Every word, including the first, starts with a capital.
Where it is used:
- Class names in almost every language:
UserAccount,DatabaseConnection - React components:
NavBar,ProductCard - C# variables and methods
- TypeScript interfaces and types
snake_case
Words are separated by underscores and everything is lowercase. It is easy to read because the underscore acts as a visible space — your eye naturally separates the words.
Where it is used:
- Python variables, functions, and file names:
get_user_data(),max_retry_count - Ruby variables and methods
- Database column names:
created_at,user_id - Constants in many languages (often UPPER_SNAKE_CASE):
MAX_CONNECTIONS
kebab-case
Words are separated by hyphens. The name is a joke — the words are "skewered" together like kebab meat on a stick. Also called spinal-case or hyphen-case.
Where it is used:
- CSS class names and custom properties:
background-color,font-size - HTML attributes
- URL slugs:
how-to-create-strong-password - File names in web projects:
user-profile.html - npm package names:
react-router-dom
Note: kebab-case cannot be used for variable names in most programming languages because the hyphen is interpreted as a minus operator.
UPPERCASE and constants
All-caps is reserved almost universally for constants — values that never change during program execution. The convention signals to any developer reading the code: "do not reassign this."
MAX_RETRIES = 3API_BASE_URL = "https://api.example.com"DEBUG_MODE = false
Title Case and Sentence case
These are writing conventions rather than programming ones. Title Case capitalises the first letter of every word and is used for headings, article titles, and product names. Sentence case capitalises only the first word and is the standard for body text, captions, and UI labels in modern design systems.
Most major tech companies (Google, Apple, Microsoft) have shifted their UIs toward sentence case for labels and buttons — it feels more natural and conversational than title case.
Convert your text now
Paste any text and convert it to camelCase, snake_case, kebab-case or any other format in one click.
Open Case Converter