If you've worked in software development for any length of time, you've encountered a dozen different naming conventions. JavaScript uses camelCase, Python uses snake_case, CSS class names often use kebab-case, and constants are SCREAMING_SNAKE_CASE. Knowing which to use and when saves debugging time and keeps your codebase consistent.

The Main Convention Types

camelCase

First word lowercase, subsequent words capitalised, no separators: userName, getFilePath, isActive. This is the standard in JavaScript, TypeScript, Java, and Swift for variables and function names.

PascalCase (UpperCamelCase)

Every word capitalised: UserName, GetFilePath, IsActive. Used for class names in most object-oriented languages, React component names, and TypeScript interfaces.

Advertisement

snake_case

Words separated by underscores, all lowercase: user_name, get_file_path, is_active. Standard in Python, Ruby, and Rust for variables and function names. Database column names almost always use snake_case.

SCREAMING_SNAKE_CASE

All uppercase with underscores: MAX_RETRIES, DEFAULT_TIMEOUT, API_BASE_URL. Used for constants in most languages — the visual difference signals "do not modify this value."

kebab-case

Words separated by hyphens, all lowercase: user-name, get-file-path. Standard for CSS class names, URL slugs, and file names in many projects. HTML attributes also use kebab-case.

When to Use Each

In Code

Follow the convention of your language. Fighting against a language's default style makes your code harder for other developers to read. If you're writing Python, use snake_case. If JavaScript, use camelCase. If you're writing a library that will be consumed from multiple languages, check what's idiomatic for the primary consumer.

In URLs

Use kebab-case for URL slugs. /blog/how-to-use-qr-codes is better than /blog/howToUseQRCodes or /blog/how_to_use_qr_codes. Search engines parse hyphens as word separators, while underscores are often treated as part of a single word.

In CSS

Use kebab-case for class names: .card-title, .btn-primary. CSS itself uses kebab-case for property names (font-size, line-height), so staying consistent makes sense.

In Databases

Use snake_case for table and column names: user_accounts, created_at, email_verified. Most SQL databases are case-insensitive by default, and mixed case can cause issues on different operating systems.

In File Names

This depends on your project's conventions. Web projects often use kebab-case (user-profile.tsx). Python projects use snake_case (user_profile.py). The important thing is consistency within a project.

Converting Between Cases

When your API returns snake_case from a Python backend but your React frontend expects camelCase, you need to convert. Libraries like humps (JavaScript) or inflection (Python) handle this automatically. Or use the case converter on this site — paste your text and convert between all 12 formats instantly.

Common Mistakes

The case converter on this site supports all 12 formats: UPPER, lower, Title, Sentence, camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, aLtErNaTiNg, esrever (reversed), and Capitalize Each Word. Paste your text and click to convert.