Programming naming conventions: camelCase, PascalCase, snake_case, and kebab-case explained

Writing clean code goes beyond just making it compile and work correctly. Readability is crucial for maintenance, collaboration, and debugging. One of the fundamental pillars of readable software engineering is adopting consistent naming conventions for your variables, functions, classes, database columns, and files.

Because white space characters are not permitted inside variable identifiers across almost all programming languages, developers use capital letters or delimiter characters to separate words. Over decades of software development, several distinct conventions have emerged as industry standards. The most prominent are camelCase, PascalCase, snake_case, kebab-case, and SCREAMING_SNAKE_CASE.

Style Guides: Different languages and communities have their own established standards. Using the correct casing makes your code feel native to that language's ecosystem and significantly accelerates team onboarding.

The core casing conventions

1. camelCase (lowerCamelCase)

In camelCase, the first word begins with a lowercase letter, while every subsequent word begins with an uppercase letter without spaces or punctuation marks. The varying height of the letters resembles the humps of a camel.

  • Examples: userFirstName, calculateTotalDuration, isActive, parseJsonPayload
  • Standard applications: Variable, parameter, and function names in JavaScript, TypeScript, Java, C#, Swift, and Kotlin.

2. PascalCase (UpperCamelCase)

PascalCase follows the same capitalization principle as camelCase, with one crucial difference: the very first letter of the first word is also capitalized. It is named after the Pascal programming language, which popularized this convention.

  • Examples: UserProfile, ImageCompressor, LocalizedLayout, DatabaseConnectionPool
  • Standard applications: Classes, interfaces, types, enums, and namespaces in C#, Java, Python, TypeScript, and React component names.

3. snake_case

In snake_case, all letters are lowercase, and individual words are joined together by an underscore (_). This format is visually distinct and highly readable because the underscores naturally emulate word spacing.

  • Examples: user_first_name, database_connection, calculate_total_duration, created_at
  • Standard applications: Functions, variables, and module names in Python (PEP 8), Ruby, Rust, C, and relational database column names in PostgreSQL and MySQL.

4. kebab-case

In kebab-case, all letters are lowercase, and words are joined by hyphens (-). The name evokes meat and vegetables held together on a skewer.

  • Examples: user-first-name, case-converter, main-layout-wrapper, button-primary
  • Standard applications: URL slugs, REST API endpoints, CSS classes, HTML custom attributes, and package names in npm and Cargo.

5. SCREAMING_SNAKE_CASE

Also known as MACRO_CASE or CONSTANT_CASE, this variation writes every letter in uppercase with underscores between words.

  • Examples: MAX_RETRY_COUNT, DEFAULT_TIMEOUT_MS, API_SECRET_KEY
  • Standard applications: Global constants, environment variables, configuration parameters, and enum values across almost all modern languages.

Quick comparison cheat sheet

ConventionFirst LetterSeparatorPrimary Use CaseExample
camelCaseLowercaseNoneVariables and functions in JS, TS, JavatotalUserCount
PascalCaseUppercaseNoneClasses, Types, and React ComponentsUserProfileCard
snake_caseLowercaseUnderscore (_)Python, Rust, and Database fieldstotal_user_count
kebab-caseLowercaseHyphen (-)URLs, CSS classes, and filenamestotal-user-count
SCREAMING_SNAKEUppercaseUnderscore (_)Global constants and ENV variablesMAX_RETRY_LIMIT

Why cannot kebab-case be used in variable names?

A common question among beginners is why kebab-case is not used for variables in languages like JavaScript, Python, or Java. The reason is syntax parsing: in programming languages, the hyphen character (-) is reserved as the subtraction operator.

When an interpreter or compiler encounters an expression like first-name, it parses the line as first minus name rather than a single variable name. As a result, kebab-case is strictly confined to contexts that allow hyphens without mathematical ambiguity, such as HTML attributes, CSS property names and class selectors, and web URL paths.

Best practices for acronyms in identifiers

When a variable name contains an acronym such as HTTP, URL, or ID, teams frequently debate how to format it. Modern style guides typically recommend treating acronyms as regular words:

  • camelCase: Prefer parseHttpUrl and userId over parseHTTPURL and userID. Treating acronyms as regular words prevents awkward consecutive uppercase sequences.
  • PascalCase: Prefer HttpConnectionManager over HTTPConnectionManager for better visual delineation between words.
  • snake_case: In snake_case, acronyms simply remain lowercase separated by underscores: parse_http_url and user_id.

Convert text formats instantly

When migrating data between database schemas (snake_case), API contracts (camelCase), and React components (PascalCase), manually rewriting dozens of property names can be time-consuming and error-prone. You can use our free Case Converter to switch text between uppercase, lowercase, camelCase, PascalCase, snake_case, and kebab-case instantly. All transformations run locally in your browser with complete privacy.

Ready to convert casing styles? Open the Case Converter