Skip to main content
Development

Text Case Conventions in Programming

Understand camelCase, PascalCase, snake_case, kebab-case, and SCREAMING_SNAKE_CASE — when each is used, why the conventions exist, and how to convert between them instantly.

January 3, 20254 min readTextNoteKit

Every codebase has naming conventions — rules that determine how variables, functions, classes, files, and database columns are named. These aren't just stylistic preferences; they're communication tools that signal intent, improve readability, and reduce friction when multiple developers work on the same code.

Understanding the major case styles and their contexts is a fundamental skill for any developer working across languages and frameworks.

The Five Major Case Styles

camelCase

Starts with a lowercase letter. Each subsequent word starts with an uppercase letter. No separators.

userName
getUserData()
totalItemCount

Used in: JavaScript/TypeScript variables and functions, Java variables, JSON property names, Swift variables, Kotlin variables.

CamelCase is the most common convention among developers because it's the default for JavaScript — the most widely used programming language in the world.

PascalCase (UpperCamelCase)

Like camelCase, but the first letter is also uppercase.

UserProfile
GetUserData()
DatabaseConnection

Used in: Class names in almost all languages (JavaScript, TypeScript, Java, C#, Python), React component names, type aliases in TypeScript, constructors in JavaScript.

If you see PascalCase in JavaScript, it's almost certainly a class or a React component. This convention creates a visual distinction between "things" (PascalCase) and "actions" (camelCase).

snake_case

All lowercase. Words separated by underscores.

user_name
get_user_data()
total_item_count

Used in: Python variables and functions (PEP 8 standard), Ruby variables and methods, database table and column names (SQL), C standard library functions, file names in many systems.

Python's official style guide (PEP 8) mandates snake_case for variables and functions. If you're writing Python and using camelCase, your code will stand out — not in a good way.

kebab-case (spinal-case)

All lowercase. Words separated by hyphens.

user-name
get-user-data
total-item-count

Used in: CSS class names and property names, HTML attribute names, URL slugs, file names in many frameworks (React component files, Nuxt pages), npm package names.

Kebab-case can't be used for variable or function names in most programming languages because the hyphen is the subtraction operator. But it dominates in contexts where hyphens don't ambiguously parse as operators: CSS, HTML, and URLs.

SCREAMING_SNAKE_CASE (CONSTANT_CASE)

All uppercase. Words separated by underscores.

MAX_RETRY_COUNT
API_BASE_URL
DEFAULT_TIMEOUT_MS

Used in: Constants and environment variables in most languages, enum values in many languages, preprocessor macros in C/C++.

The uppercase signals to other developers: "this value doesn't change at runtime." It's a communication convention as much as a formatting one.

Mixed Conventions in Real Projects

Real projects use multiple conventions simultaneously. A React + Python project might have:

  • PascalCase for React components (UserProfile.jsx)
  • camelCase for JavaScript variables and props (userName)
  • kebab-case for CSS classes (user-card)
  • snake_case for Python API endpoints and database columns (user_name)
  • CONSTANT_CASE for environment variables (DATABASE_URL)

This is normal — different contexts have different conventions. What's important is consistency within each context.

Converting Between Cases

Working with external APIs, legacy codebases, or cross-language projects often requires converting between naming conventions. Database columns are typically snake_case while JavaScript objects expect camelCase. Config files use kebab-case while your constants need SCREAMING_SNAKE_CASE.

Manual conversion is error-prone, especially for multi-word names. A case converter tool handles this instantly.

Convert between camelCase, snake_case, PascalCase, and more — instantly

Generate kebab-case URL slugs from any text

💡 Key Takeaway

"Consistency in naming conventions is more important than which convention you choose. A codebase that uses camelCase everywhere is far easier to read than one that mixes camelCase, snake_case, and PascalCase randomly."

Developer Tip: Be Consistent, Not Perfect

The worst naming is inconsistent naming. A codebase that mixes camelCase and snake_case arbitrarily is harder to work with than one that uses either convention exclusively. Choose your conventions at the start of a project, document them in a style guide or linter config, and enforce them automatically with tools like ESLint, Prettier, or Black (Python).