FixThatApp

Text Case Conversion: When to Use camelCase, snake_case, and More

Published March 5, 2026

Naming things is one of the two hardest problems in computer science (alongside cache invalidation and off-by-one errors). Choosing the right case convention for your variables, functions, classes, and file names is not just about aesthetics -- it affects code readability, team collaboration, and even how well your code integrates with frameworks and libraries.

This guide explains every major naming convention, when to use each one, and which languages and contexts prefer which style.

The Major Case Styles Explained

StyleExampleAlso Known As
camelCasegetUserNameLower camel case
PascalCaseUserAccountUpper camel case
snake_caseuser_nameUnderscore case
SCREAMING_SNAKE_CASEMAX_RETRIESConstant case
kebab-caseuser-profileDash case, hyphen case
UPPERCASEUSERNAMEAll caps
lowercaseusernameAll lower
Title CaseUser NameStart case
Sentence caseUser name here--
dot.caseuser.nameDot notation

When to Use Each Convention

camelCase

The go-to convention for variables and functions in JavaScript, TypeScript, Java, and C#. The first word is lowercase, and each subsequent word is capitalized. It is also the standard for JSON keys in most JavaScript-based APIs.

let userName = "Alice";
function getUserProfile() { ... }

PascalCase

Used for class names, components, and types across nearly all languages. In React, all component names must be PascalCase. It is also the convention for C# methods and public properties.

class UserAccount { ... }
function ProfileCard() { return <div>...</div>; }

snake_case

The standard for variables and functions in Python, Ruby, Rust, and PHP. It is also the convention for database column names in most SQL databases and for JSON keys in Python-based APIs.

user_name = "Alice"
def get_user_profile():
    pass

SCREAMING_SNAKE_CASE

Reserved for constants in virtually every language. When you see all caps with underscores, it signals that a value should not be modified.

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

kebab-case

The standard for URLs, CSS class names, and file names in web projects. Hyphens are more readable than underscores in URLs and are the convention in HTML attribute names.

<div class="user-profile-card">...</div>
/* file: user-profile.css */

Convert Text Between Any Case Style

Paste your text and instantly convert between camelCase, snake_case, PascalCase, and more.

Try the Text Case Converter

Language-Specific Conventions

JavaScript / TypeScript

Python

Java / C#

Go

CSS / HTML

Databases

Tip: Consistency beats correctness.

The most important rule is to be consistent within your project. If your team uses camelCase for JSON keys, do not mix in snake_case. Use a linter to enforce conventions automatically. When working with JSON APIs, our JSON Formatter can help you spot inconsistent key naming.

Troubleshooting Case-Related Issues

My CSS class names are not applying

CSS class names are case-sensitive. If your HTML says class="UserCard" but your CSS targets .usercard, the styles will not apply. Stick to kebab-case for CSS classes to avoid this entirely.

My imports are failing on Linux but work on Mac/Windows

Mac and Windows file systems are case-insensitive by default, but Linux is case-sensitive. A file named UserProfile.js will not be found by import './userprofile.js' on Linux. Always match the exact case of file names in your imports.

My API returns different cases than expected

When a frontend (JavaScript, using camelCase) communicates with a backend (Python, using snake_case), you need a serialization layer that converts between them. Most frameworks (like Django REST Framework or NestJS) have built-in support for this.

Database queries are case-sensitive when they should not be

PostgreSQL treats unquoted identifiers as lowercase. If you create a column as "userName" (quoted), you must always quote it. Use snake_case without quotes to avoid this problem.

Getting naming conventions right saves time in code reviews, reduces bugs from case mismatches, and makes your codebase more welcoming to new contributors. Use our free Text Case Converter to quickly transform text between any convention, and pick a style guide that matches your language's community standards.