Blog / Tool Tips & Guides

camelCase vs snake_case vs kebab-case: When to Use Each

By Abid · August 22, 2026

There are four naming styles in common use and each one has a home. Picking by preference rather than by convention is how a codebase ends up with three spellings of the same field. The Case Style Converter moves text between them.

Where each one belongs

camelCase - first word lowercase, each following word capitalised - is the convention in JavaScript, Java and C# for variables and functions, and it is the standard for keys in JSON consumed by those languages.

PascalCase, the same with the first word capitalised too, names classes and types in most of those languages, and components in React. The distinction is useful: reading a name tells you whether it is a value or a type.

snake_case - lowercase with underscores - is the Python convention for variables and functions, and the near-universal one for database table and column names. SQL is case-insensitive about identifiers in confusing ways, so lowercase with underscores avoids the whole question.

kebab-case - lowercase with hyphens - belongs in URLs, CSS class names, HTML attributes and file names. An underscore is unavailable in a CSS identifier in the way a hyphen is, and search engines treat the hyphen as a word break, which is why slugs from the Text to Slug Converter use it.

There is also SCREAMING_SNAKE_CASE, reserved almost everywhere for constants and environment variables, which is why an uppercase name in code reads as "this does not change".

Why it is not taste

Convention is the point. A reader who knows the language reads information from the shape of a name before reading the name itself, and breaking the convention removes that information and announces that the author is new.

The practical cost arrives at the boundaries. A Python backend using snake_case talking to a JavaScript frontend using camelCase has to convert somewhere, and the only wrong answer is converting in several places inconsistently. Pick one layer - usually the serialisation boundary - and do it all there.

The acronym trap

What do you do with an acronym in camelCase? Is it parseHTML or parseHtml, userID or userId? Both are defensible and the mixture is not. Most style guides now say treat an acronym as a word, giving parseHtml and userId, because it is the rule that survives contact with a converter. Whichever you choose, the only thing that matters is that your codebase chooses once.

Common questions

Which style for JSON keys?

camelCase if the main consumer is JavaScript, snake_case if it is Python. Consistency across the API matters more than the choice.

Can I use hyphens in a variable name?

No - in most languages a hyphen is the minus operator, which is why kebab-case never appears in code.

What about file names?

kebab-case is safest. Spaces need quoting and uppercase letters behave differently across operating systems.

How do I rename a field everywhere?

Carefully, with the Find and Replace Tool for text and whole-word matching, because a partial match inside a longer name is the usual accident.

Got names to convert between styles?

Convert between case styles