Skip to main content

Developer

camelCase, snake_case and kebab-case: naming conventions explained

When to use camelCase, PascalCase, snake_case, kebab-case and CONSTANT_CASE in code, files and URLs.

Published 2026-10-14

Why naming conventions exist

Names cannot contain spaces in most programming languages, file systems and URLs, so words are joined in a consistent style. A shared convention makes code easier to read and avoids arguments in code review.

The right style depends on the language and the place the name is used. Following the community convention matters more than personal taste.

camelCase and PascalCase

camelCase starts with a lowercase letter and capitalises each following word, as in userAccountName. It is the standard for variables and functions in JavaScript, Java and many other languages.

PascalCase capitalises the first word too, as in UserAccount. It is used for classes, types and React components.

snake_case and CONSTANT_CASE

snake_case separates lowercase words with underscores, as in user_account_name. It is common in Python, Ruby, Rust and database column names.

CONSTANT_CASE uses uppercase words with underscores, as in MAX_RETRY_COUNT, and is the usual style for constants and environment variables.

kebab-case in URLs and CSS

kebab-case joins lowercase words with hyphens, as in user-account-name. It is the recommended style for URLs, because search engines treat hyphens as word separators, and it is common for CSS classes and file names.

Use the case converter to switch any text between these styles, along with title case, sentence case and UPPERCASE.