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

ConventionExampleSeparatorFirst LetterPrimary Languages
camelCaseuserNameNoneLowercaseJS, Java, Swift
PascalCaseUserNameNoneUppercaseC#, React, Kotlin
snake_caseuser_nameUnderscore _LowercasePython, Ruby, SQL
kebab-caseuser-nameHyphen -LowercaseCSS, HTML, URLs
SCREAMING_SNAKEUSER_NAMEUnderscore _UPPERCASEConstants in most langs
userProfileName

camelCase

Starts with lowercase. Each subsequent word starts with uppercase. No separators.

Language / ContextUsed ForExample
JavaScript / TypeScriptVariables, functions, object propertiesgetUserName(), firstName
JavaVariables, methodscalculateTotal(), itemCount
SwiftVariables and functionsviewDidLoad(), userName
Go (unexported)Package-level unexported identifiersmyFunction, localVar
JSON keysStandard API response format{ "userId": 1 }
UserProfileName

PascalCase

Same as camelCase but the very first letter is also uppercase. Also called UpperCamelCase.

Language / ContextUsed ForExample
C#Classes, methods, properties, namespacesUserController, GetById()
React (JSX)All component namesShoppingCart, NavBar
TypeScriptTypes, interfaces, enumsUserProfile, OrderStatus
KotlinClass and object namesDataRepository, ApiClient
Dart / FlutterClasses and widgetsStatefulWidget, MyApp
user_profile_name

snake_case

All lowercase, words separated by underscores. Reads like a snake stretched across the text.

Language / ContextUsed ForExample
PythonVariables, functions, modules (PEP 8)get_user_name(), total_price
Ruby / RailsMethods and local variablesfind_by_id(), user_count
PostgreSQLTable and column namesuser_profiles, created_at
MySQLTables and columnsorder_items, product_id
RustVariables and functionsmy_variable, calculate_sum()
user-profile-name

kebab-case

All lowercase, words separated by hyphens. Also called dash-case or hyphen-case.

Language / ContextUsed ForExample
CSSClass names and custom properties.primary-button, --text-color
HTMLdata-* attributesdata-user-id, data-item-count
URL slugsPage paths and route segments/blog/my-post-title
Vue.jsComponent names in templates<my-component />
NPM packagesPackage namesreact-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

Related Tools & Guides