TitleCasePro logo TitleCasePro

Programming Naming Conventions: The Complete Guide | TitleCasePro

A complete guide to camelCase, PascalCase, snake_case, kebab-case, and CONSTANT_CASE: what each is, which languages use them, and when to use which.

· 8 min read · Try Case Converter →

Quick answer: The six naming conventions you’ll meet in code are camelCase (firstName), PascalCase (FirstName), snake_case (first_name), kebab-case (first-name), CONSTANT_CASE (FIRST_NAME), and dot.case (first.name). Which one to use depends on your language and what you’re naming — variable, class, constant, file, or URL.

Naming conventions are the rules that decide how you combine multiple words into a single identifier. Every language and ecosystem has its own preferences, and following them makes your code readable to other developers and consistent with the libraries you use.

The Six Conventions at a Glance

ConventionExamplePrimary use
camelCasegetUserNameJS/TS variables, functions, JSON keys
PascalCaseGetUserNameClasses, types, React/Vue components, C# methods
snake_caseget_user_namePython, Ruby, SQL, Rust variables
kebab-caseget-user-nameURLs, CSS classes, HTML attributes, file names
CONSTANT_CASEMAX_RETRY_COUNTConstants, environment variables
dot.caseapp.config.jsonConfig files, namespaces, i18n keys

camelCase — Variables and Functions

camelCase joins words with no spaces and capitalizes every word except the first: firstName, getUserProfile.

Used for: JavaScript and TypeScript variables and functions, Java methods and fields, Swift and Kotlin variables, and JSON keys.

const userName = "Alice";
function calculateTotalPrice(items) { /* ... */ }

PascalCase — Classes and Components

PascalCase capitalizes every word including the first: UserProfile, HttpClient.

Used for: Class names, interfaces, types, enums, and React/Vue components in nearly every language. C# also uses it for public methods and properties.

class DatabaseConnection { /* ... */ }
interface ApiResponse { /* ... */ }
const UserCard = () => { /* React component */ };

⚠️ React requirement: Component names must be PascalCase. React uses capitalization to distinguish components (<MyButton>) from DOM elements (<button>). A lowercase component name will not render.

snake_case — Python, Ruby, and Databases

snake_case separates lowercase words with underscores: first_name, get_user_by_id.

Used for: Python variables and functions (PEP 8), Ruby methods, SQL column and table names, and Rust variables.

def get_user_profile(user_id):
    first_name = db.query(user_id).first_name
    return first_name

kebab-case — URLs, CSS, and Files

kebab-case separates lowercase words with hyphens: user-profile, main-nav.

Used for: URL slugs, CSS class names, HTML attributes, npm package names, and CLI flags. Cannot be used for code variables — the hyphen is the subtraction operator.

.user-profile-card { color: blue; }

SEO note: Google recommends hyphens (kebab-case) in URLs over underscores, because it tokenizes hyphenated words as separate, individually searchable terms.

CONSTANT_CASE — Constants and Environment Variables

CONSTANT_CASE (also called SCREAMING_SNAKE_CASE) is all-uppercase snake_case: MAX_RETRIES, DATABASE_URL.

Used for: Compile-time constants and environment variables across most languages.

const MAX_RETRIES = 3;
const API_BASE_URL = process.env.API_BASE_URL;

dot.case — Config and Namespaces

dot.case separates lowercase words with dots: app.config.json, user.profile.name.

Used for: Configuration file names, Java package fragments, and internationalization (i18n) keys.

Naming Conventions by Language

LanguageVariablesFunctionsClassesConstants
JavaScript / TypeScriptcamelCasecamelCasePascalCaseCONSTANT_CASE
Pythonsnake_casesnake_casePascalCaseCONSTANT_CASE
JavacamelCasecamelCasePascalCaseCONSTANT_CASE
C#camelCasePascalCasePascalCasePascalCase
Rubysnake_casesnake_casePascalCaseCONSTANT_CASE
Rustsnake_casesnake_casePascalCaseCONSTANT_CASE
GocamelCase / PascalCase*camelCase / PascalCase*PascalCaseCONSTANT_CASE / PascalCase

*In Go, capitalization controls visibility: PascalCase identifiers are exported (public), camelCase are unexported (private).

The Acronym Debate: parseUrl vs parseURL

One long-running debate is how to handle acronyms in camelCase and PascalCase:

  • Treat as a word (modern, recommended): parseUrl, HtmlParser, userId
  • Keep fully uppercase (older): parseURL, HTMLParser, userID

Recommendation: Modern style guides (Google, Airbnb) recommend treating acronyms as words (parseUrl). It keeps compound names readable, especially when two acronyms collide (parseHTMLURL vs parseHtmlUrl).

Common Pitfalls When Converting Between Cases

  • API mismatches: Python backends return snake_case; JavaScript frontends expect camelCase. Configure your serializer to convert automatically.
  • Underscores in URLs: Always use hyphens, never underscores, in URL slugs for SEO.
  • Inconsistent acronyms: Pick one acronym style and apply it across the whole codebase.

Convert Between All Conventions Instantly

The case converter shows all of these conventions at once. Paste any phrase or identifier — like get user profile — and instantly see getUserProfile, GetUserProfile, get_user_profile, get-user-profile, GET_USER_PROFILE, and get.user.profile. Copy whichever one your context needs.

Learn Each Convention in Depth

Related articles