camelCase vs snake_case vs kebab-case

Understand the differences between the most common identifier naming conventions and when each one belongs in your code.

Compare camelCase, PascalCase, snake_case and kebab-case naming conventions used in modern programming.

Key points from this guide

  • camelCase: JavaScript, Java and C# variables and methods. snake_case: Python, Ruby, Rust and SQL columns. kebab-case: URLs, CSS classes, HTML attributes and file names. PascalCase: classes, types and React components.
  • kebab-case cannot be used for identifiers in most languages because the hyphen parses as subtraction — Lisp and Clojure are the exceptions.
  • Acronyms are the main source of inconsistency: HttpClient and getHttpResponse are the recommended forms in .NET and Java rather than HTTPClient.
  • SQL identifiers are folded to lowercase unless quoted, which is why snake_case became the norm for column names.
  • Mixed conventions inside one codebase cost more than the wrong convention consistently applied — pick per language and enforce with a linter.

Frequently asked questions

Which case should database columns use?

snake_case. Unquoted identifiers are lowercased by PostgreSQL and MySQL anyway, so camelCase columns end up needing quotes everywhere.

Is kebab-case or snake_case better for URLs?

kebab-case. Google treats hyphens as word separators in URLs and underscores as joiners, so hyphens split the words as intended.