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.
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
| Convention | Example | Primary use |
|---|---|---|
| camelCase | getUserName | JS/TS variables, functions, JSON keys |
| PascalCase | GetUserName | Classes, types, React/Vue components, C# methods |
| snake_case | get_user_name | Python, Ruby, SQL, Rust variables |
| kebab-case | get-user-name | URLs, CSS classes, HTML attributes, file names |
| CONSTANT_CASE | MAX_RETRY_COUNT | Constants, environment variables |
| dot.case | app.config.json | Config 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
| Language | Variables | Functions | Classes | Constants |
|---|---|---|---|---|
| JavaScript / TypeScript | camelCase | camelCase | PascalCase | CONSTANT_CASE |
| Python | snake_case | snake_case | PascalCase | CONSTANT_CASE |
| Java | camelCase | camelCase | PascalCase | CONSTANT_CASE |
| C# | camelCase | PascalCase | PascalCase | PascalCase |
| Ruby | snake_case | snake_case | PascalCase | CONSTANT_CASE |
| Rust | snake_case | snake_case | PascalCase | CONSTANT_CASE |
| Go | camelCase / PascalCase* | camelCase / PascalCase* | PascalCase | CONSTANT_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 (parseHTMLURLvsparseHtmlUrl).
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
Ready to try it?
Use our free Case Converter to apply these rules instantly — no signup required.
Open Case Converter →Related articles
How Long Does It Take to Read and Speak Text? (WPM Reference)
Reading time and speaking time are calculated from word count. Here are the exact formulas, average WPM rates by context, and a comparison table for common content lengths.
How to Clean Up Messy Text — Remove Line Breaks, Spaces, and Duplicates
A practical guide to fixing common text formatting problems: extra line breaks from PDFs, double spaces, blank lines, and duplicate entries. Includes one-click fixes.
How to Extract Email Addresses From Text (Any Format)
Learn how to extract email addresses from plain text, HTML, CSV files, and logs instantly — and which patterns count as valid emails.
How to Extract URLs From Text — Links, Hrefs, and Bare Domains
How to pull all URLs and links out of any text — HTML source, Markdown, log files, or plain prose — and get a clean deduplicated list.