camelCase vs snake_case vs kebab-case: Naming Conventions Explained
Published November 25, 2026 · 7 min read
Programmers can't use spaces in names, so they join words in a few standard ways. camelCase joins words with capitals, snake_case uses underscores, and kebab-case uses hyphens. Each language has its own habit, and following it makes your code easier for others to read. Here is what each style looks like and where to use it.
Need to convert a name? Paste it into the Text Case Converter and switch between camelCase, PascalCase, snake_case, CONSTANT_CASE and kebab-case in one click. Put one name per line to convert a whole list.
The five styles at a glance
| Style | Example | How it works |
|---|---|---|
| camelCase | userFirstName | First word lowercase, each next word capitalized |
| PascalCase | UserFirstName | Every word capitalized, including the first |
| snake_case | user_first_name | All lowercase, words joined with underscores |
| SCREAMING_SNAKE_CASE | USER_FIRST_NAME | All uppercase with underscores |
| kebab-case | user-first-name | All lowercase, words joined with hyphens |
PascalCase is also called UpperCamelCase or StudlyCaps. SCREAMING_SNAKE_CASE is also called CONSTANT_CASE. kebab-case is sometimes called dash-case or spinal-case.
Which style each language uses
| Language or context | Variables and functions | Classes | Constants |
|---|---|---|---|
| JavaScript / TypeScript | camelCase | PascalCase | SCREAMING_SNAKE_CASE |
| Python (PEP 8) | snake_case | PascalCase | SCREAMING_SNAKE_CASE |
| PHP (PSR-1) | camelCase methods | PascalCase | SCREAMING_SNAKE_CASE |
| Java | camelCase | PascalCase | SCREAMING_SNAKE_CASE |
| C# | camelCase locals, PascalCase methods | PascalCase | PascalCase |
| SQL tables and columns | snake_case | n/a | n/a |
| CSS classes, HTML attributes | kebab-case | n/a | n/a |
| URLs and file names on the web | kebab-case | n/a | n/a |
Real examples by framework
Laravel: model classes are PascalCase and singular (OrderItem), database
tables are snake_case and plural (order_items), columns are snake_case
(created_at), and route URLs are kebab-case (/order-items). Laravel relies on
these names to link models to tables automatically.
Vue.js: component files and names use PascalCase (UserCard.vue). In
templates written directly in HTML they are written in kebab-case (<user-card>),
because HTML is not case-sensitive. Props are camelCase in JavaScript and kebab-case in those
templates.
Django / Flask: functions, variables and URL names are snake_case
(get_user_profile), and model classes are PascalCase (UserProfile).
React: components must be PascalCase (UserCard). A lowercase name is
treated as a plain HTML tag.
Why kebab-case wins for URLs
Google recommends hyphens instead of underscores in URLs, because hyphens clearly separate words for
both people and search engines. So /text-case-converter is better than
/text_case_converter or /textCaseConverter. Use the
URL Slug Generator to turn any title into a
kebab-case slug, and see how
to create an SEO-friendly URL slug for the full rules.
What about JSON keys?
There is no single rule. JavaScript-based APIs usually use camelCase (firstName), while
many Python and Ruby APIs use snake_case (first_name). Pick one and use it for the whole
API. You can check a response with the JSON Formatter to
make keys easy to read.
Common mistakes
- Mixing styles in one file.
getUsernext toget_ordermakes code harder to scan. - Hyphens in variable names.
user-nameis read as “user minus name” in most languages. - Inconsistent acronyms. Pick
userIdoruserIDand stick with it. Most style guides preferuserId, which is also what the converter produces. - Spaces or capitals in URLs.
/My Pagebecomes/My%20Page, and some servers treat capitals as different pages.
Writing headings instead of code? The title case rules cover which words to capitalize in a title.
Paste words or an existing name like getUserID and get camelCase, PascalCase, snake_case, CONSTANT_CASE or kebab-case instantly.
Frequently asked questions
Is camelCase the same as PascalCase?
Nearly. camelCase starts with a lowercase letter (userName), PascalCase starts with a capital (UserName).
Why does Python use snake_case?
Python’s official style guide, PEP 8, recommends snake_case for functions and variables because it reads easily.
Should I use underscores or hyphens in file names?
For web pages and images, use hyphens. For Python modules, use underscores, because hyphens break imports.
What case should database columns use?
snake_case is the most common choice in MySQL and PostgreSQL, and it avoids quoting problems with capital letters.
Related articles
How to Change Uppercase to Lowercase in Word, Google Docs and Excel
Shift + F3 in Word, the Capitalization menu in Docs, LOWER and PROPER in Excel and Sheets, and a one-click converter that works anywhere, phones included.
Read More →How to Create an SEO-Friendly URL Slug: Rules, Examples and Mistakes
What a URL slug is, 9 rules for SEO-friendly slugs with good and bad examples, how to handle accents and stop words, and how to change a slug safely with a 301 redirect.
Read More →How to Format, Validate and Fix JSON (With Common Errors Explained)
Turn minified JSON into readable text, validate it, and fix the most common JSON errors: trailing commas, single quotes, unquoted keys and comments. Plus formatting in VS Code and on the command line.
Read More →