Developer Guide · All Languages
camelCase vs PascalCase vs snake_case vs kebab-case
Every programming language has conventions for naming variables, functions, and files. This guide explains the four major naming styles, when to use each, and provides real-world examples by language.
Quick Comparison
| Convention | Example | Separator | First Letter | Primary Languages |
|---|---|---|---|---|
| camelCase | userName | None | Lowercase | JS, Java, Swift |
| PascalCase | UserName | None | Uppercase | C#, React, Kotlin |
| snake_case | user_name | Underscore _ | Lowercase | Python, Ruby, SQL |
| kebab-case | user-name | Hyphen - | Lowercase | CSS, HTML, URLs |
| SCREAMING_SNAKE | USER_NAME | Underscore _ | UPPERCASE | Constants in most langs |
userProfileName
camelCase
Starts with lowercase. Each subsequent word starts with uppercase. No separators.
| Language / Context | Used For | Example |
|---|---|---|
| JavaScript / TypeScript | Variables, functions, object properties | getUserName(), firstName |
| Java | Variables, methods | calculateTotal(), itemCount |
| Swift | Variables and functions | viewDidLoad(), userName |
| Go (unexported) | Package-level unexported identifiers | myFunction, localVar |
| JSON keys | Standard API response format | { "userId": 1 } |
UserProfileName
PascalCase
Same as camelCase but the very first letter is also uppercase. Also called UpperCamelCase.
| Language / Context | Used For | Example |
|---|---|---|
| C# | Classes, methods, properties, namespaces | UserController, GetById() |
| React (JSX) | All component names | ShoppingCart, NavBar |
| TypeScript | Types, interfaces, enums | UserProfile, OrderStatus |
| Kotlin | Class and object names | DataRepository, ApiClient |
| Dart / Flutter | Classes and widgets | StatefulWidget, MyApp |
user_profile_name
snake_case
All lowercase, words separated by underscores. Reads like a snake stretched across the text.
| Language / Context | Used For | Example |
|---|---|---|
| Python | Variables, functions, modules (PEP 8) | get_user_name(), total_price |
| Ruby / Rails | Methods and local variables | find_by_id(), user_count |
| PostgreSQL | Table and column names | user_profiles, created_at |
| MySQL | Tables and columns | order_items, product_id |
| Rust | Variables and functions | my_variable, calculate_sum() |
user-profile-name
kebab-case
All lowercase, words separated by hyphens. Also called dash-case or hyphen-case.
| Language / Context | Used For | Example |
|---|---|---|
| CSS | Class names and custom properties | .primary-button, --text-color |
| HTML | data-* attributes | data-user-id, data-item-count |
| URL slugs | Page paths and route segments | /blog/my-post-title |
| Vue.js | Component names in templates | <my-component /> |
| NPM packages | Package names | react-query, next-auth |
Convert to Any Naming Convention
Use the tool below to instantly convert any phrase to your preferred naming convention.
0 Chars
0 Words
0 Lines
