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

Multi-Toolkit Team6 min read
Developer ToolsProgrammingProductivity

Every programming language, framework, and platform has its own naming convention — and using the wrong case format is one of the most common code style violations. A variable named UserName in a Python codebase or user_name in a React component stands out immediately as a convention mismatch. This guide covers when to use each of the 16 text case formats.

Programming naming conventions by language

JavaScript / TypeScript: Variables and functions use camelCase. Classes, interfaces, and React components use PascalCase. Constants use SCREAMING_SNAKE_CASE. CSS class names and HTML attributes use kebab-case. File names typically use kebab-case for components and camelCase for utilities.

Python: Variables, functions, and methods use snake_case. Classes use PascalCase. Module-level constants use SCREAMING_SNAKE_CASE. This is specified in PEP 8, Python's official style guide.

Java / Kotlin: Variables and methods use camelCase. Classes use PascalCase. Constants use SCREAMING_SNAKE_CASE. Package names use all lowercase with dots as separators.

Go: Exported identifiers (public) use PascalCase. Unexported identifiers (private) use camelCase. There is no convention for constants — they follow the same exported/unexported rule.

Rust: Variables, functions, and modules use snake_case. Types and traits use PascalCase. Constants and statics use SCREAMING_SNAKE_CASE.

SQL / Database: Column names, table names, and aliases use snake_case. This is the universal SQL convention regardless of database engine.

CSS / HTML: Class names, IDs, and custom properties use kebab-case. HTTP header names use Train-Case (e.g. Content-Type, X-Request-Id).

URLs and npm packages: Always kebab-case. Hyphens are word separators in URLs; underscores are not treated as separators by most search engines.

When to use Title Case and Sentence case

Title Case capitalizes major words (nouns, verbs, adjectives, adverbs) while keeping articles (a, an, the), short prepositions (in, of, at, on), and coordinating conjunctions (and, but, or) lowercase — unless they are the first or last word. This follows AP and Chicago style. Use it for headlines, article titles, page headings, and UI button labels.

Sentence case capitalizes only the first letter of the first word. It reads more naturally as prose and is increasingly preferred in modern UI design for subheadings, navigation labels, and form field labels — it feels less formal than Title Case.

How to convert between any two formats

The hardest part of manual case conversion is word boundary detection. The converter handles all input formats automatically:

  • helloWorld → detects camelCase boundary → words: hello, world
  • hello_world → splits on underscore → words: hello, world
  • hello-world → splits on hyphen → words: hello, world
  • Hello World → splits on space → words: hello, world

Paste any identifier in any format and get all 16 conversions simultaneously — no need to know what format the input is in.

Convert text between all 16 case formats instantly — camelCase, snake_case, kebab-case and more:

Open Case Converter →

← Back to all articles