Guide

Programming case conventions

A short, opinionated reference to camelCase, PascalCase, snake_case, kebab-case, and CONSTANT_CASE — and when to reach for each.

Most programming languages have a preferred way of writing identifiers. The convention isn't usually enforced by the compiler — it's enforced by the people reading your code. Following the local style keeps a codebase scannable and lets tools (linters, formatters, IDE search) do their job.

camelCase

userProfileName

Also known as: lowerCamelCase, dromedaryCase

Variables and functions in JavaScript, TypeScript, Java, Swift, Kotlin.

PascalCase

UserProfileName

Also known as: UpperCamelCase

Classes, types, components, and interfaces in most C-family languages and React.

snake_case

user_profile_name

Also known as: lower_snake_case

Variables and functions in Python, Ruby, Rust, and most SQL identifiers.

kebab-case

user-profile-name

Also known as: dash-case, lisp-case, spinal-case

URLs, CSS class names, HTML attributes, CLI flags, npm packages.

CONSTANT_CASE

USER_PROFILE_NAME

Also known as: SCREAMING_SNAKE_CASE, MACRO_CASE

Constants and environment variables across nearly every language.

Which one should I use?

Match the language and the surrounding code. Some quick defaults:

  • JavaScript / TypeScript: camelCase for variables and functions, PascalCase for classes, types, and React components, CONSTANT_CASE for true constants, kebab-case for file names and npm packages.
  • Python / Ruby: snake_case for variables and functions, PascalCase for classes, CONSTANT_CASE for module-level constants.
  • Rust: snake_case for functions and modules, PascalCase for types and traits, CONSTANT_CASE for constants and statics.
  • CSS / HTML / URLs: kebab-case almost everywhere — class names, custom properties, attributes, paths.
  • SQL: snake_case for tables and columns; keywords often shouted in UPPER CASE.

Convert between them

The converter now ships with camelCase, PascalCase, snake_case, kebab-case, and CONSTANT_CASE alongside the writing-style cases. Paste an identifier or a sentence and switch between styles instantly.

FAQ

Is camelCase or snake_case more readable?

Studies are mixed; snake_case is slightly easier to parse for beginners, camelCase is marginally faster to type. Consistency inside a codebase matters far more than the choice itself.

What's the difference between camelCase and PascalCase?

Only the first letter. camelCase starts lowercase (userName), PascalCase starts uppercase (UserName). Both join words without separators.

Why is kebab-case used in URLs?

Underscores were historically harder to see under link underlines, and search engines treat hyphens as word separators. Hyphenated slugs are easier to read and better for SEO.