Dev ToolsMarch 28, 2026

Text Case Guide: camelCase, snake_case, PascalCase & More Explained (2026)

By The hakaru Team·Last updated March 2026

Quick Answer

  • *camelCase (helloWorld) is standard for JavaScript/TypeScript variables and functions — used by 62.3% of developers per Stack Overflow 2024.
  • *snake_case (hello_world) is the Python standard per PEP 8, and also used in Ruby, SQL, and database columns.
  • *PascalCase (HelloWorld) is used for class names across most languages and for React component names.
  • *kebab-case (hello-world) is preferred for URLs, CSS classes, and HTML attributes per the Google HTML/CSS Style Guide.

The Complete Text Case Reference Table

Every programming language, framework, and writing context has its own preferred naming convention. This table gives you the full picture at a glance.

Case FormatExampleUsed In
camelCasehelloWorldJavaScript variables, Java variables, TypeScript
PascalCaseHelloWorldClass names (most languages), React components, C# types
snake_casehello_worldPython, Ruby, SQL, database columns
SCREAMING_SNAKEHELLO_WORLDConstants (most languages), environment variables
kebab-casehello-worldURLs, CSS classes, HTML attributes, file names
dot.casehello.worldConfig files, Java packages, i18n keys
Title CaseHello WorldHeadings, book titles, UI labels
Sentence caseHello worldBody text, email subjects, tooltips
UPPERCASEHELLO WORLDAcronyms, SQL keywords, emphasis
lowercasehello worldEmail addresses, some file names, URLs

camelCase: The JavaScript Standard

camelCase gets its name from the humps created by the capital letters in the middle of a word. The first word is all lowercase; every subsequent word starts with a capital letter. No spaces, no underscores, no hyphens.

Examples: getUserById, fetchApiData, isLoggedIn, handleSubmitForm.

According to Stack Overflow’s 2024 Developer Survey, JavaScript is used by 62.3% of developers — making camelCase one of the most common naming conventions in the world. TypeScript (a JavaScript superset) follows the same convention. Java and C# use camelCase for local variables and method parameters, though they use PascalCase for method names in some contexts.

When to use camelCase

  • JavaScript and TypeScript variable names, function names, object properties
  • Java instance variables and local variables
  • C# fields, parameters, and local variables
  • Go variable names (though Go also accepts short lowercase names for locals)
  • JSON keys (the most common convention, though not enforced)

PascalCase: For Classes and Components

PascalCase (also called UpperCamelCase) is identical to camelCase except the first letter is also capitalized. helloWorld in camelCase becomes HelloWorld in PascalCase.

Examples: UserProfile, HttpRequest, OrderItemList, DatabaseConnection.

PascalCase is the near-universal standard for class names across Python, Java, C#, TypeScript, and most other mainstream languages. React enforces it for components — a component named myButton will not render as a custom element; it must be MyButton. According to Stack Overflow 2024, Java and C# combined represent roughly 35% of developer language use, both following PascalCase for class names.

When to use PascalCase

  • Class names in Python, Java, C#, TypeScript, Ruby, and most other languages
  • React and Next.js component names
  • TypeScript interfaces and type aliases (UserProfile, ApiResponse)
  • C# namespaces and method names
  • Enum names and enum members (in many style guides)

snake_case: Python’s Convention

snake_case uses all lowercase letters with words joined by underscores. It is the most readable of the programmatic cases because word boundaries are visually explicit.

Examples: user_first_name, get_order_by_id, is_logged_in, created_at.

PEP 8 — the Python Enhancement Proposal that established Python’s official style guide in 2001 — specifies snake_case for all variable names and function names. Python is used by 51% of developers per Stack Overflow 2024, making this a dominant convention. A 2020 study published at ICSE found that inconsistent naming conventions contribute to code maintenance issues for 23% of developers, which is part of why Python’s strict PEP 8 standard has been so influential.

When to use snake_case

  • Python variables, function names, module names (per PEP 8)
  • Ruby variables and method names
  • SQL column names and table names (order_id, created_at)
  • Database column names (PostgreSQL, MySQL, SQLite)
  • Rust variable and function names
  • File names in Python projects and Linux systems

SCREAMING_SNAKE_CASE: Constants

SCREAMING_SNAKE_CASE (all caps with underscores) signals that a value is a constant — something that should not change at runtime. The visual weight of all-caps makes constants stand out immediately in code.

Examples: MAX_RETRIES, API_BASE_URL, DEFAULT_TIMEOUT_MS, DB_CONNECTION_LIMIT.

This convention is used in Python (for module-level constants per PEP 8), JavaScript/TypeScript (for const values that represent fixed configuration), Java (for static final fields), and most other languages. Environment variables follow this convention by convention — DATABASE_URL, SECRET_KEY, NODE_ENV.

kebab-case: The Web Format

kebab-case uses all lowercase with hyphens between words. It looks like words on a skewer — hence the name. It cannot be used as a variable name in most programming languages (because - is the subtraction operator), so it lives in config files, markup, and URLs.

Examples: nav-bar, user-profile-card, primary-color, /about-us.

The Google HTML/CSS Style Guide recommends kebab-case for all HTML and CSS identifiers. URLs follow kebab-case by SEO convention — /blog/how-to-write-clean-code is preferred over /blog/howToWriteCleanCode because search engines treat hyphens as word separators. Tailwind CSS class names use kebab-case. HTML custom data attributes use it too: data-user-id, data-track-event.

When to use kebab-case

  • URL slugs and path segments
  • CSS class names and IDs
  • HTML attributes and data attributes
  • NPM package names (react-dom, next-auth)
  • File names in web projects (user-profile.tsx, auth-middleware.ts)
  • YAML keys in some configurations

dot.case and Other Formats

dot.case uses periods as separators. It is common in Java package names (com.example.myapp), configuration keys (spring.datasource.url), and internationalization files (nav.home.title). It is not a programming case per se — more a hierarchical naming pattern.

Title Case vs. Sentence Case

These two are for natural language text, not code. They matter for headings, UI labels, email subjects, and anywhere copy appears.

Title Case

Title Case capitalizes the first letter of most words. The exact rules vary by style guide, but the core pattern:

  • Always capitalize: the first word, the last word, nouns, verbs, adjectives, adverbs, pronouns, and subordinating conjunctions (because, although, since)
  • Typically lowercase: articles (a, an, the), short prepositions (in, on, at, to, for, of), coordinating conjunctions (and, but, or, nor, so, yet)

Example: “How to Write an ATS-Friendly Resume in 2026” — note “an” and “in” are lowercase; “ATS-Friendly” and “Resume” are capitalized.

AP Style, Chicago Manual, and APA style each have slightly different rules on prepositions over four or five letters. When in doubt: if the word carries meaning, capitalize it.

Sentence Case

Sentence case capitalizes only the first word and proper nouns — exactly like a normal English sentence. It reads as more conversational and is increasingly common in UI copy, tooltips, button labels, and product interfaces. Google’s Material Design guidelines recommend sentence case for most UI text.

Title Case: “Save Your Changes”
Sentence case: “Save your changes”

Naming Conventions by Programming Language

LanguageVariables / FunctionsClassesConstantsFiles
JavaScript / TypeScriptcamelCasePascalCaseSCREAMING_SNAKEkebab-case or camelCase
Pythonsnake_casePascalCaseSCREAMING_SNAKEsnake_case
JavacamelCasePascalCaseSCREAMING_SNAKEPascalCase (matches class)
C#camelCasePascalCasePascalCase or SCREAMING_SNAKEPascalCase
Rubysnake_casePascalCaseSCREAMING_SNAKEsnake_case
GocamelCasePascalCasecamelCase or PascalCasesnake_case
Rustsnake_casePascalCaseSCREAMING_SNAKEsnake_case
PHPcamelCase or snake_casePascalCaseSCREAMING_SNAKEPascalCase or snake_case
SQLsnake_caseN/AUPPERCASEsnake_case
CSSkebab-caseN/AN/Akebab-case

Go is an interesting case: public identifiers (exported from a package) use PascalCase; private identifiers use camelCase. The visibility is baked into the capitalization. There is no public or privatekeyword — the case itself is the access modifier.

Why Naming Conventions Matter

A 2020 study presented at ICSE (International Conference on Software Engineering) found that 23% of developers cite inconsistent naming conventions as a contributor to code maintenance problems. That is not a minor nuisance — it compounds over years in a codebase.

The Google Style Guides for JavaScript, Python, Java, and Go are among the most-referenced coding style guides in professional development. They exist because consistent naming reduces the cognitive load of reading code. When you see getUserById, you immediately know it is a function. When you see UserProfile, you know it is a class or component. When you see MAX_CONNECTIONS, you know it is a constant. The naming does work that comments and documentation otherwise have to do.

Common Mistakes

Mixing conventions in the same codebase

The most common mistake is inconsistency. A Python codebase with both getUserData and get_user_data for different functions is harder to read than one that uses snake_case everywhere. Pick the convention for your language and stick with it.

Using camelCase in URLs

URLs should use kebab-case. /blog/howToCalculateTax is harder to read and shares link equity less effectively than /blog/how-to-calculate-tax. Most major CMS platforms default to kebab-case slugs for this reason.

Forgetting SCREAMING_SNAKE for environment variables

Environment variables like databaseUrl or apiKey are technically valid but non-standard. The convention is DATABASE_URL and API_KEY. Most deployment platforms (Vercel, Railway, Heroku) display env vars in uppercase, so mixing conventions causes confusion when switching between local development and production.

Convert text between any case format instantly

Use our free Case Converter →

Converts to camelCase, PascalCase, snake_case, kebab-case, SCREAMING_SNAKE, Title Case, and more

Frequently Asked Questions

What is camelCase?

camelCase is a naming convention where the first word is all lowercase and each subsequent word starts with an uppercase letter — no spaces or separators. Example: helloWorld, getUserById, fetchApiData. It is the standard for variables and function names in JavaScript, TypeScript, Java, and C#. The name comes from the humps formed by the capital letters in the middle.

What is the difference between camelCase and PascalCase?

The only difference is the first letter. camelCase starts with a lowercase letter (helloWorld), while PascalCase starts with an uppercase letter (HelloWorld). PascalCase is sometimes called UpperCamelCase for this reason. In practice: use camelCase for variable and function names, PascalCase for class names and React components.

What case format does Python use?

Python uses snake_case for variable names and function names (per PEP 8), PascalCase for class names, and SCREAMING_SNAKE_CASE for constants. For example: user_name (variable), get_user_by_id (function), UserProfile (class), MAX_RETRIES (constant). PEP 8 was established in 2001 by the Python Software Foundation and remains the definitive style reference.

What is snake_case used for?

snake_case uses all lowercase letters with words separated by underscores. It is the standard for Python variables and functions (PEP 8), Ruby variables and methods, SQL column names, database table names, and file names in many Unix-based systems. It is considered the most readable convention for multi-word identifiers because word boundaries are unambiguous. Example: user_first_name, created_at, order_total.

What is kebab-case?

kebab-case uses all lowercase letters with words separated by hyphens. It is preferred for URLs (/about-us), CSS class names (.nav-bar), HTML data attributes (data-user-id), NPM package names (react-dom), and web project file names. Per the Google HTML/CSS Style Guide, kebab-case is the recommended format for HTML and CSS identifiers. It cannot be used as a variable name in most programming languages because the hyphen is the subtraction operator.

What are the rules for Title Case?

Title Case capitalizes the first and last words of a title, plus all nouns, verbs, adjectives, adverbs, and pronouns. Articles (a, an, the), short prepositions (in, on, at, to, for, of), and coordinating conjunctions (and, but, or, nor) are typically lowercased unless they appear as the first or last word. Different style guides have slightly different rules: AP Style lowercases prepositions of any length; Chicago Manual of Style lowercases only prepositions under five letters. When in doubt — if the word carries meaning, capitalize it.