Skip to content
Text 6 min read

Naming Conventions: camelCase, snake_case, PascalCase, and kebab-case

Understand when to use camelCase, snake_case, PascalCase, SCREAMING_SNAKE, and kebab-case across JavaScript, Python, CSS, URLs, and databases.

ToolsVito Team

The Naming Conventions

  • camelCase — first word lowercase, subsequent words capitalized: getUserName, isLoading
  • PascalCase (UpperCamelCase) — every word capitalized: UserProfile, HttpClient
  • snake_case — words joined by underscores, all lowercase: user_name, max_retries
  • SCREAMING_SNAKE_CASE — snake_case but uppercase: MAX_RETRIES, API_BASE_URL
  • kebab-case — words joined by hyphens, all lowercase: user-profile, font-size
  • flatcase — no separator, all lowercase: username — avoid except for very short identifiers

JavaScript / TypeScript

// Variables and functions: camelCase
const userName = "Jane";
function getUserById(id) {}

// Classes and interfaces: PascalCase
class UserService {}
interface ApiResponse {}
type UserId = string;

// Constants: SCREAMING_SNAKE_CASE
const MAX_RETRIES = 3;
const API_BASE_URL = "https://api.example.com";

// Enum members: PascalCase (TS) or SCREAMING_SNAKE (JS)
enum Status { Active, Inactive }

// React components: PascalCase (required — lowercase = DOM element)
function UserCard({ user }) {}
const UserCard = () => {};

Python

# Variables and functions: snake_case (PEP 8)
user_name = "Jane"
def get_user_by_id(user_id): pass

# Classes: PascalCase
class UserService: pass

# Constants: SCREAMING_SNAKE_CASE
MAX_RETRIES = 3
API_BASE_URL = "https://api.example.com"

# Private: leading underscore
_internal_cache = {}
__name_mangled = {}  # double underscore = name mangling

CSS

/* Properties: kebab-case (it's the spec) */
.user-card {
  font-size: 1rem;
  background-color: #fff;
  border-top-left-radius: 8px;
}

/* Custom properties (CSS variables): kebab-case */
:root {
  --color-primary: #0a0a0a;
  --font-size-body: 1rem;
}

/* BEM: block__element--modifier */
.card__header--active {}

Databases

-- SQL columns: snake_case (standard)
CREATE TABLE users (
  user_id     SERIAL PRIMARY KEY,
  first_name  TEXT NOT NULL,
  created_at  TIMESTAMPTZ DEFAULT NOW()
);

-- PostgreSQL is case-insensitive without quotes; snake_case avoids quoting
-- "FirstName" (PascalCase) requires quotes everywhere: SELECT "FirstName" FROM users

URLs and File Names

# URLs: kebab-case (Google recommends; underscores not treated as word separators)
/blog/naming-conventions-guide      ✓
/blog/naming_conventions_guide      ✗ (underscores not recommended for URLs)
/blog/NamingConventionsGuide        ✗ (not lowercase, not URL-friendly)

# File names: kebab-case for web assets, snake_case for Python modules
user-profile.tsx   ← React component file
user_service.py    ← Python module

Convert Case Instantly

Use ToolsVito's Case Converter to convert any text between camelCase, snake_case, PascalCase, kebab-case, and more in one click.

Try it now — free, runs in your browser

Case Converter

camelCase, snake_case & more