Back to Blog
DeveloperJanuary 27, 20268 min read

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

CaseExampleUsed In
camelCasemyVariableNameJavaScript, Java, TypeScript variables and functions
PascalCaseMyClassNameReact components, C# classes, TypeScript interfaces
snake_casemy_variable_namePython, Ruby, Rust, SQL, database columns
kebab-casemy-component-nameCSS classes, HTML attributes, URLs, file names
CONSTANT_CASEMAX_RETRY_COUNTConstants in most languages
dot.casemy.config.valueJava properties, configuration keys
Title CaseMy Variable NameUI 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.ts

Python

# Variables and functions: snake_case
user_name = 'Alice'
def get_user_profile():
    pass

# Classes: PascalCase
class UserService:
    pass

# Constants: CONSTANT_CASE
MAX_RETRY_COUNT = 3

CSS

/* 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 free

Related articles