camelCase vs snake_case vs PascalCase vs kebab-case — Which to Use?

Updated October 2026 · 4 min read

Convert text between any case instantly with our free Text Case Converter.

Every programming language, framework, and platform has its own convention for writing multi-word identifiers. Getting it wrong does not usually break code, but it marks you as unfamiliar with the ecosystem — and in some systems (CSS properties, URL routing) the wrong case causes real bugs.

The Four Main Naming Conventions

ConventionExampleSeparator
camelCasegetUserEmailNone — capital letter signals a new word
PascalCaseUserEmailServiceNone — every word starts with a capital
snake_caseget_user_emailUnderscore between words
kebab-caseget-user-emailHyphen between words

Which Case for Which Language?

JavaScript / TypeScript

  • camelCase: variables, functions, method names
  • PascalCase: classes, React components, TypeScript interfaces and types
  • SCREAMING_SNAKE_CASE: module-level constants — MAX_RETRY_COUNT, API_BASE_URL

Python (PEP 8)

  • snake_case: variables, functions, module names — the default for nearly everything
  • PascalCase: class names only
  • UPPER_SNAKE_CASE: constants

CSS

  • kebab-case: class names and custom properties — .user-profile, --primary-color
  • Hyphens are part of CSS syntax; underscores technically require escaping in some selector contexts

URLs and Slugs

  • kebab-case always: spaces become %20 or + in URLs. Google treats hyphens as word separators and underscores as word joiners, so kebab-case is better for SEO

Databases

  • PostgreSQL / MySQL: snake_case for table and column names
  • Some ORMs use PascalCase for model names and map to snake_case tables automatically

The Golden Rule: Consistency Over Convention

The specific convention matters less than applying it consistently across a codebase. A project that mixes getUserEmail and get_user_email in the same file is harder to read than one that picks either and sticks with it everywhere. Use a linter (ESLint for JS, Pylint for Python, Stylelint for CSS) to enforce conventions automatically rather than relying on manual review.

Convert Text Between Any Case

Paste your text and click a button — camelCase, PascalCase, snake_case, kebab-case and more.

Open Free Text Case Converter