All Naming Conventions at a Glance
Before diving into each convention's details and use cases, here's a reference table with every major style:
| Convention | Example | Also Known As |
|---|---|---|
| camelCase | getUserName | lower camelCase, dromedaryCase |
| PascalCase | GetUserName | UpperCamelCase, StudlyCase |
| snake_case | get_user_name | lower_snake_case, underscored |
| UPPER_SNAKE_CASE | MAX_RETRY_COUNT | SCREAMING_SNAKE_CASE, CONSTANT_CASE |
| kebab-case | get-user-name | hyphen-case, spinal-case, lisp-case |
| Title Case | Get User Name | Headline case |
| Sentence case | Get user name | Normal capitalization |
| flatcase | getusername | lowercase (rare in modern code) |
All of these conventions address the same problem: identifiers in code cannot contain spaces, so multi-word names need a separator strategy. Each solution has evolved for different contexts with different requirements.
camelCase
camelCase joins words by capitalizing the first letter of each word except the very first, which remains lowercase. The capital letters resemble a camel's humps, hence the name.
camelCase is the dominant convention in JavaScript, TypeScript, Java, C#, Swift, Kotlin, and Dart. In these languages it's used for:
- Variable names:
let userName = "Alice"; - Function and method names:
function calculateTotal() - Object properties:
user.firstName - JSON keys (by convention):
{"firstName": "Alice"}
JavaScript in particular makes camelCase almost universal for any non-class identifier. The language's standard library (parseInt, getElementById, addEventListener) is all camelCase, and major frameworks like React, Vue, and Angular follow the same convention for prop names and methods.
One nuance: abbreviations in camelCase. Is it XMLParser or XmlParser? Modern style guides generally prefer treating abbreviations as regular words: XmlParser for PascalCase, xmlParser for camelCase. This is the approach recommended by Google's Java style guide.
PascalCase (UpperCamelCase)
PascalCase capitalizes the first letter of every word including the first. It looks identical to camelCase except for that initial capital. Named after the Pascal programming language, where this style was popularized.
PascalCase is almost universally used for class names across most programming languages:
- JavaScript/TypeScript classes:
class UserAuthentication {} - React components:
function NavBar() {} - C# classes, interfaces, and public members:
class HttpClientWrapper {} - Java classes:
class DatabaseConnection {} - Python classes:
class PaymentProcessor:
The reason class names use PascalCase while functions use camelCase (in languages that differentiate) is semantic: PascalCase visually signals "this is a type/constructor" rather than "this is a function call." When you see new UserProfile(), the PascalCase immediately tells you this is a constructor, not a regular function.
C# goes furthest with PascalCase, applying it to all public class members (methods, properties, events, constants) as specified in the Microsoft .NET naming guidelines — not just classes.
snake_case
snake_case uses underscores as word separators with all letters in lowercase. It's readable because the underscore acts as a visual space, and it avoids any ambiguity about where word boundaries are (unlike camelCase where it's not always obvious).
snake_case is the standard in Python — mandated by PEP 8 for variable names, function names, method names, and module names. It's also standard in Ruby, Rust (for non-type identifiers), PHP, and database naming (table columns, SQL identifiers).
Python examples following PEP 8:
- Variables:
user_name, total_price, is_valid - Functions:
def calculate_monthly_payment(): - Module names:
database_utils.py - Class names (PascalCase exception):
class UserProfile: - Constants (UPPER_SNAKE_CASE exception):
MAX_CONNECTIONS = 100
The snake_case vs camelCase debate among Python developers coming from JavaScript backgrounds is common. PEP 8 is not just a recommendation — it's the accepted community standard, and Python code that uses camelCase for variables is immediately recognizable as non-idiomatic and signals unfamiliarity with Python conventions.
kebab-case
kebab-case uses hyphens as word separators with all lowercase letters. Named because the words "skewered" by hyphens resemble ingredients on a kebab skewer.
kebab-case is the standard in:
- CSS: All property names (
background-color,font-size,border-radius) and class names (.nav-menu,.hero-section) - HTML attributes: Custom data attributes (
data-user-id,data-product-name) - URL slugs:
/blog/how-to-use-mortgage-calculator— search engines and humans both read hyphens as word separators in URLs - HTML element names: Custom elements (
<my-component>) - Command-line flags:
--output-format,--max-connections
kebab-case cannot be used in most programming languages for variable names because the hyphen is the subtraction operator — first-name would be interpreted as first minus name. This limits its use to contexts where identifiers are interpreted as strings rather than evaluated as code (CSS, HTML, URLs, config files).
For URL slugs specifically, Google's John Mueller has confirmed that hyphens are the preferred separator for SEO purposes — Google treats hyphens as word separators but underscores as joining characters, so mortgage-calculator is treated as two words while mortgage_calculator is treated as one compound word.
UPPER_SNAKE_CASE
UPPER_SNAKE_CASE combines uppercase letters with underscores. Also called SCREAMING_SNAKE_CASE (a name that captures the visual intensity of all caps).
This convention is almost universally reserved for constants — values that are defined once and never change. The visual weight of all caps signals to readers "this value is fixed, don't change it."
- Python:
MAX_CONNECTIONS = 100, DEFAULT_TIMEOUT = 30, API_BASE_URL = "..." - JavaScript:
const MAX_RETRIES = 3;(though JS also uses camelCase for const) - Java:
static final int MAX_SIZE = 1000; - C/C++:
#define MAX_BUFFER_SIZE 4096 - Environment variables:
DATABASE_URL, SECRET_KEY, NODE_ENV
Environment variables in operating systems use UPPER_SNAKE_CASE as a universal convention — PATH, HOME, DATABASE_URL. This is why Docker, cloud platforms, and configuration management tools all use this style for environment variable names.
Title Case and Sentence Case
These are less about programming identifiers and more about human-readable text, but they appear in UI strings, headings, button labels, and documentation.
Title Case capitalizes the first letter of every major word (nouns, verbs, adjectives, adverbs). Articles (a, an, the), short prepositions (in, on, at), and conjunctions (and, but) are typically lowercase unless they're the first word. Used for: article headlines, product names, H1/H2 headings, navigation items.
Sentence case capitalizes only the first word and proper nouns — like a normal sentence. Used for: UI labels, button text, form field labels, error messages, help text. Sentence case is generally more readable for UI text and has become preferred in modern design systems (Google Material Design, Atlassian, etc.).
Consistency within a product is more important than the specific choice. A UI that mixes Title Case buttons with sentence case labels looks inconsistent and unpolished. For converting text between all these formats instantly, the ToolMasta Case Converter handles all styles in one tool. See also our dedicated guide on text case conversion formats.
Which Convention for Which Language
| Language | Variables/Functions | Classes | Constants | CSS/Files |
|---|---|---|---|---|
| JavaScript / TypeScript | camelCase | PascalCase | UPPER_SNAKE or camelCase | kebab-case |
| Python | snake_case | PascalCase | UPPER_SNAKE_CASE | snake_case |
| Java | camelCase | PascalCase | UPPER_SNAKE_CASE | kebab-case |
| C# | camelCase (private), PascalCase (public) | PascalCase | PascalCase | kebab-case |
| Rust | snake_case | PascalCase | UPPER_SNAKE_CASE | snake_case |
| Go | camelCase | PascalCase (exported) | PascalCase (exported) | N/A |
| Ruby | snake_case | PascalCase | UPPER_SNAKE_CASE | snake_case |
| CSS | kebab-case (classes) | N/A | kebab-case (custom props) | N/A |
| SQL | snake_case | N/A | UPPER_CASE keywords | N/A |
Official Style Guides
When working in a codebase or organization, official style guides are the definitive authority. Here are the most influential:
Python — PEP 8: The Python Enhancement Proposal 8 is Python's official style guide, authored by Guido van Rossum. It covers naming, indentation, line length, imports, and more. Following PEP 8 is essentially mandatory for professional Python development.
JavaScript — Airbnb Style Guide: While not "official" (JavaScript has no formal style authority), the Airbnb JavaScript style guide has become the de facto standard in the industry. It mandates camelCase for variables/functions and PascalCase for constructors and React components.
Google Style Guides: Google publishes style guides for JavaScript, TypeScript, Java, C++, Python, and more at google.github.io/styleguide. They're well-documented, well-reasoned, and influential.
C# — Microsoft .NET Guidelines: Microsoft's documentation provides comprehensive naming conventions for .NET, prescribing PascalCase for all public members and camelCase for private fields. The naming guidelines are part of the .NET Framework Design Guidelines.
For teams without a designated style guide, ESLint (JavaScript) and Pylint/Flake8/Black (Python) can automatically enforce naming conventions. Auto-formatters like Prettier (JS) and Black (Python) take the discussion out of code review entirely by making style non-negotiable.
Try It Free — No Signup Required
Convert any text between camelCase, PascalCase, snake_case, kebab-case, and more instantly with the ToolMasta Case Converter — no installation, no signup.
Open Case Converter