Text case styles: camelCase, snake_case, kebab-case

Published: 2026-07-20

When to use each naming convention, how to convert between them, and pitfalls with acronyms and Unicode.

Codebases mix naming conventions by layer: snake_case in Python and SQL, camelCase in JavaScript object keys, kebab-case in URLs and CSS classes, PascalCase for React components and types. Refactors and API glue often require converting the same identifier between styles.

Quick reference

Style Example Typical use
camelCase userProfileId JS/TS variables, JSON keys
PascalCase UserProfileId Classes, React components, types
snake_case user_profile_id Python, Ruby, Postgres columns
kebab-case user-profile-id URLs, HTML data-*, CSS
CONSTANT_CASE USER_PROFILE_ID Env vars, C macros, enum-like constants

Rules of thumb

  • JSON from JavaScript APIs often uses camelCase; Python services may expect snake_case — document the boundary.
  • URLs should stay lowercase kebab; avoid %20 from spaces (slugify helps).
  • Acronyms are inconsistent: parseJSON vs parseJson vs parse_json. Pick a team rule and automate conversion.

Unicode and locale

Case conversion is not just Aa. Turkish İ/i, German ß, and composed characters need locale-aware logic for user-facing slugs. For program identifiers, ASCII-only folding is often intentional.

One phrase vs many lines

When converting a list of identifiers (enum members, CSV column headers), decide whether each line is independent or a single phrase with spaces — "User ID"userId vs userID depending on heuristics.

Try it locally

The Text Case Converter applies local heuristics for camelCase, PascalCase, snake_case, kebab-case, and CONSTANT_CASE — one phrase per box or one conversion per line, with nothing uploaded.

For URL-safe output, follow with Slugify. For bulk line operations, see Sort lines and Dedupe lines.

Related reading

All learn articles