Krill KitsKrill Kits// A swarm of small, sharp tools for letters, numbers, and units.
§ 01 / ARTICLE

camelCase vs snake_case. vs kebab-case.

CATEGORY TEXTREAD 4 MINPUBLISHED APR 21, 2026

Three styles. Three ecosystems. One underlying idea: how do you write"user full name" as a single identifier when your language doesn't allow spaces? We ended up with camelCase, snake_case, and kebab-case — all common, none universal.

camelCase — the compact one

userFullName. The first word is lowercase, each subsequent word capitalized. Named for the "humps" in the middle. Originated in Smalltalk in the 1970s, then picked up by Java, JavaScript, and anything in that lineage. Works in any language because it uses only letters and digits — no reserved characters to trip on.

Used by: Java, JavaScript, TypeScript, C#, Swift, Kotlin, Objective-C.

snake_case — the readable one

user_full_name. Words separated by underscores. Easier to read than camelCase — underscores look like spaces, so identifiers scan more naturally. Standard in Python (PEP 8, 2001), Ruby, Rust, and most database conventions.

Used by: Python, Ruby, Rust, Perl, most SQL, PostgreSQL, JSON APIs in Python-centric ecosystems.

kebab-case — the URL one

user-full-name. Words separated by hyphens. Can't be used as a variable name in most programming languages because the hyphen is the subtraction operator — but it's dominant for URLs, CSS classes, HTML attributes, and CLI flags.

Used by: CSS, URL slugs, HTML attributes, CLI flags, many file names, Lisp dialects.

The asymmetry

Here's the part that causes real pain: ecosystems often mix conventions, and you have to translate. A JavaScript frontend fetches JSON from a Python backend — the JS code expects firstName, the Python API returns first_name. A CSS rule uses background-color, but setting it from JavaScript uses element.style.backgroundColor. Most frameworks include automatic translation because nobody wants to retype field names 200 times.

Other styles worth knowing

  • PascalCase — like camelCase but first letter capitalized. Classes, React components, types.
  • SCREAMING_SNAKE_CASE — all caps with underscores. Constants and env vars.
  • dotted.case — uncommon, used for config paths and some file organization.
  • Train-Case — like kebab-case but each word capitalized. Used in HTTP headers ("Content-Type").
// TRY THE TOOL
CONVERT CASE.

camelCase ↔ snake_case ↔ kebab-case ↔ 10 more, live in your browser.

OPEN →
§ 02 / FAQ

Questions. Answered.

Which is "best"?+
None — they’re optimal for different contexts. snake_case is most readable for humans. camelCase is compact and works where hyphens and underscores are reserved. kebab-case is the most URL-friendly because hyphens don’t need escaping and search engines treat them as word separators.
Why can’t JavaScript use kebab-case?+
Because the hyphen is the subtraction operator in JavaScript. <code>user-name</code> would be parsed as <code>user minus name</code>. Same reason CSS properties (which use kebab-case) have to be converted to camelCase when accessed from JavaScript DOM APIs.
Why does Python prefer snake_case?+
Python’s style guide (PEP 8) picked snake_case for readability in 2001. It stuck because Python’s standard library used it from day one, and the ecosystem follows stdlib style.
Is there a convention for AI models or tools?+
Yes — most AI model / tool APIs lean on snake_case for fields (OpenAI, Anthropic) because JSON consumers in the Python ecosystem dominate. Frontend code usually camelCases the same fields on its side.
§ 03 / TOOLS

Related calculators.

§ 04 / READING

Keep reading.