ToolStackToolStack
Browse Tools →
Home/Blog/Case Sensitivity Guide
EngineeringApril 13, 2026 · 5 min read

camelCase vs snake_case vs PascalCase: When to Use Each

Justin Pirrie

Justin Pirrie

Founder, ToolStack · April 13, 2026

TL;DR

  • → camelCase for JS/TS variables and functions. PascalCase for classes and React components.
  • → snake_case for Python, Ruby, SQL. kebab-case for URLs, CSS, HTML attributes.
  • → Convert between all cases instantly with the free Case Converter.
Sponsored

Advertisement Space

Naming convention is one of those things that feels trivial until you're debugging a production issue at 2am because a Python function used camelCase and the downstream JSON parser expected snake_case. The rules aren't arbitrary — they are ecosystem conventions that determine how your code integrates with frameworks, linters, and other people's code.

The 5 Naming Conventions Explained

camelCase
getUserById, isLoggedIn, totalItemCount
Use when: JavaScript/TypeScript variables, functions, object keys. React props (onClick, className). JSON keys in API responses.
Avoid for: Python code, database column names, CSS class names, URL slugs.
PascalCase
UserProfile, InvoiceGenerator, HttpClient
Use when: Class names in all OOP languages. React and Next.js component names. TypeScript interfaces and type aliases. File names for components (UserCard.tsx).
Avoid for: Variables, functions, and database fields. Anything that isn't a constructor or type.
snake_case
user_id, created_at, max_retry_count
Use when: Python variables, functions, and module names (PEP 8). Ruby variables. SQL column and table names. REST API query parameters.
Avoid for: JavaScript (unless you're working with Python-generated API data). CSS class names.
kebab-case
user-profile, invoice-generator, --dry-run
Use when: CSS class names and IDs. URL slugs and route paths. HTML data attributes (data-user-id). CLI flags (--output-dir). NPM package names.
Avoid for: Any programming language identifier — the hyphen is a minus operator in most languages.
SCREAMING_SNAKE_CASE
MAX_RETRIES, API_BASE_URL, DEFAULT_TIMEOUT
Use when: Module-level constants in Python (PEP 8). Environment variable names. Configuration constants in JavaScript/TypeScript. SQL named constraints.
Avoid for: Regular variables and function names — SCREAMING signals immutability and configuration, not logic.

Quick Reference by Language

LanguageVariables/FunctionsClassesConstants
JavaScript / TypeScriptcamelCasePascalCaseSCREAMING_SNAKE
Pythonsnake_casePascalCaseSCREAMING_SNAKE
GocamelCasePascalCasePascalCase or camelCase
Rubysnake_casePascalCaseSCREAMING_SNAKE
Java / KotlincamelCasePascalCaseSCREAMING_SNAKE
SQLsnake_casePascalCaseSCREAMING_SNAKE
CSSkebab-caseN/AN/A
URLs / Slugskebab-caseN/AN/A
Sponsored

Advertisement Space

Convert between cases in one click

The free Case Converter handles camelCase, PascalCase, snake_case, kebab-case, UPPER_CASE and more. Paste your text and get every format instantly.

Open Case Converter Free →

Frequently Asked Questions

Why does naming convention matter in programming?

Naming conventions matter for three reasons: readability (consistent style makes code scannable), tooling (linters, bundlers, and frameworks often rely on conventions to auto-discover files), and collaboration (teams work faster when everyone follows the same rules). Inconsistent naming in a large codebase is a real source of bugs — especially in case-sensitive languages and file systems.

Is JavaScript camelCase or PascalCase?

Both — context-dependent. Variables and functions use camelCase (getUserById). Classes and React components use PascalCase (UserCard). Constants use SCREAMING_SNAKE_CASE (MAX_RETRIES). CSS class names used in JS/TS typically use camelCase when referenced via styles objects, but kebab-case in CSS files.

Does Python use snake_case or camelCase?

Python's official style guide (PEP 8) specifies snake_case for variables, functions, and module names. PascalCase is used for class names. SCREAMING_SNAKE_CASE for module-level constants. Unlike JavaScript, camelCase in Python functions is considered non-idiomatic and is discouraged in code reviews.

What is kebab-case used for?

Kebab-case (words-separated-by-hyphens) is used primarily in HTML attributes, CSS class names, URL slugs, and CLI flags. It is not valid in most programming language identifiers (because the hyphen is interpreted as a minus operator) but is the standard in web contexts: class='user-card', /tools/case-converter, --dry-run.

How do I convert between cases quickly?

The ToolStack Case Converter handles all conversions instantly — paste your text and it converts to camelCase, PascalCase, snake_case, kebab-case, UPPER_CASE and more in one click. No signup, runs in your browser.

← Back to BlogOpen Case Converter →