String Case Conventions: camelCase, snake_case, kebab-case Explained
Learn all common string case conventions used in programming. When to use camelCase, snake_case, PascalCase, kebab-case, and more with language-specific guidelines.
Why Naming Conventions Matter
Every programming language and framework has its preferred way of naming variables, functions, and files. Using the right convention makes your code consistent and readable. Using the wrong one makes you look like you do not know the language.
The Major Case Types
| Case | Example | Used In |
|---|---|---|
| camelCase | myVariableName | JavaScript, Java, TypeScript variables and functions |
| PascalCase | MyClassName | React components, C# classes, TypeScript interfaces |
| snake_case | my_variable_name | Python, Ruby, Rust, SQL, database columns |
| kebab-case | my-component-name | CSS classes, HTML attributes, URLs, file names |
| CONSTANT_CASE | MAX_RETRY_COUNT | Constants in most languages |
| dot.case | my.config.value | Java properties, configuration keys |
| Title Case | My Variable Name | UI headings, display text |
Language-Specific Conventions
JavaScript / TypeScript
// Variables and functions: camelCase
const userName = 'Alice';
function getUserProfile() { }
// Classes and React components: PascalCase
class UserService { }
function UserProfile() { return <div>...</div>; }
// Constants: CONSTANT_CASE
const MAX_RETRY_COUNT = 3;
const API_BASE_URL = 'https://api.example.com';
// Files: kebab-case or camelCase
// user-profile.jsx, userService.tsPython
# Variables and functions: snake_case
user_name = 'Alice'
def get_user_profile():
pass
# Classes: PascalCase
class UserService:
pass
# Constants: CONSTANT_CASE
MAX_RETRY_COUNT = 3CSS
/* Classes: kebab-case */
.user-profile { }
.nav-link { }
.hero-section { }
/* BEM methodology */
.card { }
.card__title { }
.card--highlighted { }Convert Between Cases
Our free String Case Converter handles all major case types instantly. Paste any text and convert between camelCase, snake_case, kebab-case, PascalCase, and more.
Free String Case Converter
Convert between camelCase, snake_case, kebab-case, PascalCase, and more.
Try it freeRelated Articles
Linux File Permissions Explained: The Visual Chmod Guide
Master Linux file permissions with this visual guide. Learn chmod notation, permission types, common permission sets, and use our interactive calculator.
DeveloperYAML vs JSON: Differences, Use Cases, and Conversion Guide
Compare YAML and JSON formats side by side. Learn syntax differences, when to use which, and how to convert between them for Docker, Kubernetes, and configs.
DeveloperHow to Convert CSV Data to SQL INSERT Statements
Step-by-step guide to converting CSV files into SQL INSERT statements. Covers data types, escaping, bulk inserts, and a free automated converter tool.