camelCase, snake_case, and kebab-case: A Guide Every Developer Needs
Naming conventions are everywhere in programming. Here's a practical guide to camelCase, snake_case, kebab-case, PascalCase, and when to use each one.
MyTextConverter Team
If you've ever worked with code — or even just dabbled — you've probably noticed that variable names look different depending on where you find them. Sometimes it's getUserData, sometimes it's get_user_data, and sometimes it's get-user-data. These aren't random choices. They're naming conventions, and understanding them can save you a lot of confusion.
What Are Naming Conventions?
A naming convention is a consistent rule for how you write multi-word identifiers. Since most programming languages don't allow spaces in variable names, developers came up with creative ways to visually separate words. The result is a handful of conventions that each have their own place in different languages and contexts.
camelCase
In camelCase, the first word is lowercase and every subsequent word starts with a capital letter — like the humps on a camel. Examples: firstName, totalPrice, getUserById.
Where you'll find it: JavaScript and TypeScript variables and functions, Java, Swift, Kotlin, and most object-oriented languages use it by default. If you're writing front-end code, camelCase is your daily companion.
PascalCase
PascalCase looks a lot like camelCase, but the very first word also gets a capital letter. Examples: FirstName, UserProfile, DatabaseConnection.
Where you'll find it: Class names in almost every language, React component names (MyComponent), TypeScript interfaces and types. The rule of thumb: if it's a "thing" rather than an action or property, it probably uses PascalCase.
snake_case
Snake case uses all lowercase letters and replaces spaces with underscores. Examples: first_name, total_price, get_user_by_id.
Where you'll find it: Python (the official style guide, PEP 8, recommends it for functions and variables), Ruby, PostgreSQL and MySQL column names, many REST API response fields. If you're working with data pipelines or backend services, snake_case is everywhere.
kebab-case
Kebab case is like snake_case but uses hyphens instead of underscores. Examples: first-name, my-component, api-endpoint.
Where you'll find it: URLs (my-website.com/blog/my-first-post), CSS class names and custom properties, HTML data attributes, file names in web projects. Hyphens in URLs are preferred by search engines over underscores, which is why SEO-friendly slugs use kebab-case.
SCREAMING_SNAKE_CASE
All caps, underscores between words. Examples: MAX_RETRIES, API_BASE_URL, DEFAULT_TIMEOUT_MS.
Where you'll find it: Constants in almost every language, environment variables in .env files, configuration values that never change at runtime. If you see all-caps with underscores, it usually signals "this value is fixed."
Quick Reference
- camelCase → JavaScript/TypeScript variables & functions, Java, Swift
- PascalCase → Classes, React components, TypeScript types and interfaces
- snake_case → Python, Ruby, SQL column names, JSON API fields
- kebab-case → URLs, CSS classes, HTML attributes, file names
- SCREAMING_SNAKE_CASE → Constants and environment variables
Why Does This Actually Matter?
Consistency is the point. When everyone on a team uses the same convention, you can read unfamiliar code more quickly, catch mistakes more easily, and spend less mental energy on decisions that don't affect how the code runs.
It also matters for tooling. Linters like ESLint and Pylint can enforce naming conventions automatically. Code review becomes faster when reviewers aren't distracted by inconsistent naming. And new team members can understand what something is just from how it's named.
Converting Between Cases
Sometimes you'll receive data in one format and need it in another. A database column called user_full_name might need to become a JavaScript variable called userFullName, or a file should be renamed to kebab-case for a URL slug. Doing this manually across dozens of strings is tedious and error-prone.
Our text conversion tools handle all of these transformations instantly — paste your text and get the result in whichever case format you need.
Free tools
Ready to transform your text?
All our text tools run instantly in your browser — no sign-up, no limits, no installs.
Explore all tools