camelCase vs snake_case vs kebab-case — Which Should You Use?

4 min read

If you write code, configs, or APIs, you constantly choose how to name things. Three conventions show up everywhere: camelCase, snake_case, and kebab-case. They are not interchangeable—each ecosystem picked a style for good reasons. Picking the wrong one in the wrong layer does not break compilers by itself, but it does break expectations: linters flag it, code review slows down, and newcomers guess wrong about which file or field to import. This guide explains what each convention is, where it is idiomatic, and how to convert between them without tedious manual retyping when you inherit someone else’s naming scheme.

What is camelCase?

In camelCase, words are glued together with no spaces. The first word starts with a lowercase letter; each following word starts with uppercase. It reads like the humps on a camel.

const userName = "Ada";
const maxUploadSizeMb = 25;
function calculateTotalPrice() {}

Where it is used: JavaScript and TypeScript variables and functions, JSON keys in many APIs, and Java-style identifiers. If you open a React or Node project, camelCase is usually the default for anything that is not a class name.

What is snake_case?

In snake_case, words stay lowercase and are separated by underscores. It is easy to read and avoids “which letter is capitalized?” debates.

user_name = "Ada"
max_upload_size_mb = 25

SELECT user_id, created_at FROM orders;

Where it is used: Python (PEP 8), Ruby, many SQL column names, Postgres and SQLite defaults, environment variables, and log field names. Databases and data pipelines often standardize on snake_case so exports from different tools still line up.

What is kebab-case?

In kebab-case (also called dash-case), lowercase words are separated by hyphens—like words skewered on a kebab stick.

<button class="primary-action-btn">Save</button>
GET /api/user-profiles/123
background-color: #0f172a;

Where it is used: HTML data-* attributes, many CSS class naming schemes (including BEM-style modifiers), URL paths and slugs, and CLI flags (--max-retries). Hyphens are URL-safe and readable in prose, which is why you see them in routes and filenames more often than underscores.

Quick reference

ConventionExampleTypical homes
camelCaseorderTotalJS/TS, many JSON APIs
snake_caseorder_totalPython, SQL, env vars
kebab-caseorder-totalURLs, CSS classes, HTML

Can you mix them in one project?

Yes—most real systems do. A common pattern: snake_case in the database, camelCase in the application layer after an ORM or serializer maps columns to properties, and kebab-case in public URLs and CSS. The goal is consistency at each boundary: pick one style per layer and convert deliberately at the edges. Mixing randomly inside the same file, though, will confuse teammates and linters.

PascalCase — the cousin of camelCase

PascalCase (sometimes called UpperCamelCase) capitalizes the first letter of every word, including the first: UserAccount, OrderLineItem. In TypeScript and C#, classes, React components, and some enum names typically use PascalCase, while variables and functions stay in camelCase. When you run a case converter, make sure you select PascalCase versus camelCase intentionally—the difference is only one character, but it matters to style guides.

Convert between conventions instantly

Renaming twenty fields by hand before a deploy is error-prone. TextToolkit’s Convert workbench applies case transforms in one click— including camelCase, PascalCase, snake_case, and kebab-case—so you can paste a blob of text, pick the target style, and copy the result. When you are juggling API responses, migration scripts, or design tokens, that saves real time.

Open the case converter on TextToolkit and paste your identifiers or a whole paragraph; the tool runs entirely in your browser.