Home/Blogs/Developer & Text Tools Guide

camelCase vs snake_case vs kebab-case: When to Use Each (2026 Guide)

A complete guide to the most common text case formats in programming and web development — when to use camelCase, snake_case, kebab-case, PascalCase, and UPPER_SNAKE_CASE with real-world examples.

Need to convert text between formats instantly? Use the free Case Converter — supports 12 formats including camelCase, snake_case, kebab-case, PascalCase, and more. Instant, no signup.

Why Naming Conventions Matter

Every programming language, framework, and platform has naming conventions. Using the wrong format causes bugs, linting errors, failed API calls, and poor SEO. A JavaScript variable named User_Name instead of userName will confuse your team and fail style checks. A URL with underscores instead of hyphens hurts search ranking.

This guide covers every major format — what it looks like, where to use it, and where not to.

camelCase

Format: firstName, getUserById, isLoggedIn

The first letter is lowercase. Each new word starts with an uppercase letter. No spaces, no separators.

Use for:

  • JavaScript and TypeScript variables and functions
  • Java method and variable names
  • Swift properties and methods
  • JSON object keys (common convention)
  • React state variables and hook names (useState, useEffect)

Do not use for: Python code, CSS classes, URL slugs, database columns.

PascalCase

Format: UserProfile, GetOrderById, DatabaseConnection

Every word starts with an uppercase letter including the first. Also called UpperCamelCase.

Use for:

  • React component names (MyButton, UserCard)
  • TypeScript interfaces and types (UserProps, ApiResponse)
  • JavaScript and Java class names
  • C# methods and properties (this is the C# standard, not camelCase)
  • Enum names and values

Do not use for: Regular variables, CSS, URLs.

snake_case

Format: first_name, get_user_by_id, is_logged_in

All lowercase, words joined by underscores.

Use for:

  • Python variables, functions, and module names (PEP 8 standard)
  • Database column names (user_id, created_at)
  • Ruby variables and methods
  • Rust function names
  • File names for scripts and data files

Do not use for: URLs (use kebab-case instead), JavaScript variables, CSS classes.

kebab-case

Format: first-name, get-user-by-id, my-component

All lowercase, words joined by hyphens. Also called spinal-case or lisp-case.

Use for:

  • URL slugs — always use kebab-case for SEO (/blog/my-first-post)
  • CSS class names (.btn-primary, .card-header)
  • HTML element IDs
  • File names for web assets (my-image.jpg, main-style.css)
  • NPM package names
  • Vue.js component file names

Do not use for: Programming identifiers (hyphens are invalid in most languages), Python, JavaScript variables.

UPPER_SNAKE_CASE

Format: MAX_RETRIES, DATABASE_URL, API_BASE_URL

All uppercase, words joined by underscores. Also called SCREAMING_SNAKE_CASE or CONSTANT_CASE.

Use for:

  • Constants in JavaScript, TypeScript, and Python
  • Environment variables (NODE_ENV, DATABASE_HOST)
  • Configuration constants that should never change at runtime
  • Enum values in many languages

The all-caps style is a visual signal to developers: this value is fixed and should not be reassigned.

Quick Reference Table

Format Example Use For
camelCasegetUserNameJS/TS variables, JSON keys
PascalCaseUserProfileClasses, React components
snake_caseuser_namePython, database columns
kebab-caseuser-nameURLs, CSS classes, HTML IDs
UPPER_SNAKEMAX_RETRIESConstants, env variables
dot.caseserver.portJava packages, config keys

Convert Between Formats Instantly

Use the free Case Converter to convert any text into all 12 formats simultaneously — camelCase, PascalCase, snake_case, kebab-case, UPPER_SNAKE_CASE, dot.case, Sentence case, Title Case, and more. Paste once, copy any format.

FAQs

What is the difference between camelCase and PascalCase?

Both join words without spaces. camelCase starts with a lowercase letter (helloWorld), PascalCase starts with an uppercase letter (HelloWorld). Use camelCase for JavaScript variables and functions, PascalCase for class names and React components.

Should I use hyphens or underscores in URL slugs?

Always use hyphens (kebab-case) for URLs. Google treats hyphens as word separators, making each word a separate keyword. Underscores join words together, so 'my_page' is treated as one word rather than two.

What is snake_case used for?

snake_case is the standard for Python variable and function names (PEP 8), database column names, and environment variables. It uses underscores to join words, all lowercase: user_first_name, get_total_price.

What is UPPER_SNAKE_CASE used for?

UPPER_SNAKE_CASE (also called SCREAMING_SNAKE_CASE) is the standard for constants and environment variables: MAX_RETRIES, DATABASE_URL, API_KEY. The all-caps format signals that the value should not change at runtime.

Sponsored

Sponsored banner