UltimateTools
Digital & Text Tools

camelCase vs. snake_case vs. kebab-case: Where Each Is Used

camelCase (capitalizing each word after the first, no separators) is conventional in many programming languages for variable and function names. snake_case (lowercase with underscores) is conventional in other languages and in database column names. kebab-case (lowercase with hyphens) is conventional for URLs and CSS class names — the right choice depends entirely on the specific technical context's own convention.

Unlike Title Case and sentence case, these naming conventions come from programming and web development contexts, where consistency with a specific language or system's convention genuinely matters for compatibility and readability.

camelCase

Widely used in JavaScript, Java, and several other languages for variable and function names — the first word is lowercase, and each subsequent word starts with a capital letter, with no spaces or separators ("firstName," "calculateTotal").

snake_case

Common in Python, Ruby, and widely used for database column and table names — all lowercase, with underscores separating words ("first_name," "calculate_total"), generally considered highly readable for longer multi-word names.

kebab-case

The standard for URLs (search engines and users both generally prefer readable, hyphenated URLs) and CSS class names — all lowercase, with hyphens separating words ("first-name," "calculate-total"); it isn't used for variable names in most programming languages, since hyphens conflict with the subtraction operator in most languages' syntax.

Frequently asked questions

Does it matter which case style I use, as long as I'm consistent?

For a personal project, internal consistency matters most — but for code following a specific language's or team's established convention, matching that existing convention makes the codebase easier for others (and future you) to read and maintain.

Which case style should I use for a URL slug?

kebab-case is the strongly conventional choice for URLs — it's readable, works reliably across all browsers and systems, and is generally preferred by search engines over camelCase or snake_case in URLs.