Every programming language has a preferred way to name things. Here's when to use camelCase, snake_case, PascalCase, and kebab-case.
First word lowercase, every next word capitalized. No spaces or separators.
myVariableName, getUserData, isLoggedIn
Used in: JavaScript, Java, TypeScript, C#, Swift
Used for: variables, function names, method names
Every word capitalized, including the first. Also called UpperCamelCase.
MyClassName, UserProfile, HttpRequest
Used in: JavaScript (classes), C# (classes, methods), Java (classes), TypeScript
Used for: class names, component names, type names
All lowercase with underscores between words.
my_variable, user_name, get_user_data
Used in: Python, Ruby, Rust, SQL, PHP
Used for: variables, functions, file names, database columns
All uppercase with underscores. Also called SCREAMING_SNAKE_CASE.
MAX_SIZE, API_KEY, DATABASE_URL
Used in: all languages
Used for: constants, environment variables, config values
All lowercase with hyphens between words.
my-component, user-profile, main-content
Used in: HTML, CSS, URLs, file names
Used for: CSS classes, URL slugs, HTML attributes
Quick rule: match what your language and team already use. Consistency matters more than which convention you pick.
camelCasePascalCasesnake_casekebab-caseCONSTANT_CASEkebab-casesnake_caseNeed to convert between these formats quickly? Use our free case converter tool. Paste your text, click the format you need, and copy.