camelCase, snake_case & kebab-case Explained
2 min readUpdated June 7, 2026
A naming convention is an agreed-upon way of joining multiple words into a single identifier. Because most programming languages don't allow spaces in variable, function, or file names, developers use a case style — capital letters, underscores, or hyphens — to mark where one word ends and the next begins. The four you'll meet most often are camelCase, PascalCase, snake_case, and kebab-case.
Consistency is the whole point. When every variable in a file follows the same style, code becomes faster to scan and easier to search, and tooling like linters and autocompletion works predictably. The same is true for content: headings written in a uniform style look intentional rather than sloppy. The style you choose matters less than applying it everywhere.
The main case styles
camelCase joins words with no spaces and capitalizes every word except the first: myVariableName. The lowercase start and the little 'humps' of capital letters give it its name.
PascalCase (also called UpperCamelCase) is the same idea but capitalizes the first word too: MyClassName.
snake_case puts every word in lowercase and separates them with underscores: my_variable_name.
kebab-case is like snake_case but uses hyphens instead of underscores: my-variable-name. The hyphens look like words skewered on a kebab, hence the name. A SCREAMING_SNAKE_CASE variant uses all capitals with underscores: MY_CONSTANT_VALUE.
Where each is used
camelCase is the default for variables and functions in JavaScript and Java — for example, userName or calculateTotal.
PascalCase names classes, types, and React components: UserProfile, OrderStatus. Seeing a capitalized identifier signals 'this is a type or component, not a plain value.'
snake_case is the standard for variables and functions in Python and is widely used for database table and column names: user_id, created_at.
kebab-case shows up where lowercase and hyphens are required or preferred: URLs and slugs (/blog/my-first-post), CSS class names (.nav-item), and file names (user-profile.tsx). SCREAMING_SNAKE_CASE is reserved for constants: MAX_RETRIES, API_BASE_URL.
Title case vs sentence case
For headings and written content rather than code, the two common styles are Title Case and sentence case. Title Case capitalizes the major words — nouns, verbs, adjectives — while leaving small words like 'and', 'of', and 'the' lowercase: 'A Guide to Naming Conventions'.
Sentence case capitalizes only the first word (plus any proper nouns), exactly as you would write a normal sentence: 'A guide to naming conventions'. Many style guides and product interfaces now prefer sentence case because it reads more naturally; what matters is picking one and using it consistently across all headings.
Choosing a convention
You rarely choose a convention from scratch — you follow the norm of the language or framework you're working in. Writing Python? Use snake_case. Writing JavaScript variables? Use camelCase. Naming a React component? Use PascalCase. Building a URL or CSS class? Use kebab-case.
When a language has no strong opinion, pick a style, document it, and stay consistent. A converter tool is handy here: paste an identifier in one style and switch it to another without hand-editing every separator, which avoids the typos that creep in when you rename things manually.
Frequently asked questions
What is camelCase?+
camelCase joins words without spaces and capitalizes each word except the first, like myVariableName. It's the standard for variables and functions in JavaScript and Java.
What's the difference between camelCase and PascalCase?+
They're identical except for the first letter. camelCase keeps the first word lowercase (myClassName), while PascalCase capitalizes it too (MyClassName). PascalCase is typically used for classes, types, and React components.
Which naming convention should I use for URLs?+
Use kebab-case — all lowercase words separated by hyphens, like /my-blog-post. Hyphens are URL-friendly and readable, and search engines treat them as word separators.
Which convention does Python use?+
Python uses snake_case for variables and functions (user_name), PascalCase for class names, and SCREAMING_SNAKE_CASE for constants.
What's the difference between Title Case and sentence case?+
Title Case capitalizes the major words in a heading ('A Guide to Naming'), while sentence case capitalizes only the first word and any proper nouns ('A guide to naming'). Pick one and use it consistently.