DevTools Hub
All guides

camelCase, snake_case, kebab-case: which to use where

A short guide to the naming conventions you meet daily, which language expects which, and why acronyms break so many automatic converters.

28 July 20261 min read

Naming conventions are arbitrary, and that is exactly why consistency matters more than preference. Each ecosystem settled on one, and code that follows the local convention is easier to read than code that argues with it.

Who uses what

camelCase is the norm for variables and functions in JavaScript, Java and C#. PascalCase marks classes, types and React components in most of those same languages — the capital signals 'this is a type' before you read anything else.

snake_case belongs to Python, Ruby and SQL column names. kebab-case cannot be used for identifiers in most languages because the hyphen reads as minus, which is why it lives in URLs, CSS class names and file names. CONSTANT_CASE marks environment variables and compile-time constants nearly everywhere.

Why acronyms break converters

Converting between conventions means finding word boundaries, and XMLHttpRequest has no separators at all. A naive converter treats every capital as a boundary and produces x_m_l_http_request, which is not what anyone wants.

The rule that works is to treat a run of capitals as a single word unless it is followed by a capital and then a lowercase letter — at which point the last capital starts the next word. That yields XML / Http / Request. Most style guides now sidestep the problem by recommending XmlHttpRequest, capitalising acronyms like ordinary words.

Consistency at boundaries

The friction shows up where systems meet: a Python API returning created_at consumed by JavaScript expecting createdAt. Converting in one place — a single serialisation layer — is far better than converting ad hoc wherever the mismatch is noticed.

The alternative, letting both spellings circulate, guarantees a bug where one caller uses the wrong one and gets undefined rather than an error.

In short

Follow the local convention rather than your preference, handle acronyms as whole words, and convert between systems in exactly one place.

Case Converter

Convert names between camelCase, snake_case, kebab-case and more — all at once, acronyms intact.

Open the tool

Keep reading