Text case reference

Text Case Types: camelCase, snake_case and More

Compare camelCase, PascalCase, snake_case and kebab-case using one consistent example, then choose the convention that fits your language, framework, URL or style guide.

Four common text case types

Text case describes how words are capitalised and separated. Developer naming conventions remove normal spaces so identifiers can be read by programming languages and tools. The same phrase looks different in each convention.

UseInputResult
camelCasecustomer order totalcustomerOrderTotal
PascalCasecustomer order totalCustomerOrderTotal
snake_casecustomer order totalcustomer_order_total
kebab-casecustomer order totalcustomer-order-total

camelCase and PascalCase

camelCase begins with a lowercase word and capitalises each following word. It is common for JavaScript and TypeScript variables, functions, object properties and JSON keys. PascalCase capitalises the first word too. It is commonly used for classes, types and React components. These are conventions, so always match the surrounding project.

snake_case and kebab-case

snake_case joins lowercase words with underscores. It is common in Python identifiers, database columns and some configuration formats. kebab-case uses hyphens and is widely used for readable URLs, CSS classes and command-line flags. Most programming languages treat a hyphen as subtraction, so kebab-case normally cannot be used for a variable name.

How to choose a case style

Start with the rules of the destination language or publication, then follow the existing convention. Consistency makes names predictable and searchable. Use sentence case or the required headline style for prose; camelCase, PascalCase, snake_case and kebab-case are primarily useful for identifiers, paths and machine-readable names.