camelCase, snake_case, PascalCase — How Developers Use Case Conventions

💻
camelCase, snake_case, PascalCase — How Developers Use Case Conventions
Every naming convention explained with real code examples across popular languages
📌 Need to convert text case quickly? Use RankStreak's free Case Converter — converts between lowercase, UPPERCASE, Title Case, and Sentence case instantly. Paste your text, click, done.

If you've ever read someone else's code and felt confused by getUserById vs get_user_by_id vs GetUserById — you've encountered naming conventions. These aren't just stylistic preferences; in many languages and frameworks they carry meaning and affect how code runs.

This guide explains every major case convention used in programming, which languages use which, and how case converters help developers work faster.

The 7 Main Naming Conventions in Programming

ConventionExampleHow It Works
camelCasegetUserByIdFirst word lowercase; each subsequent word capitalised
PascalCaseGetUserByIdEvery word starts with uppercase; also called UpperCamelCase
snake_caseget_user_by_idAll lowercase; words separated by underscores
SCREAMING_SNAKE_CASEGET_USER_BY_IDAll uppercase; words separated by underscores
kebab-caseget-user-by-idAll lowercase; words separated by hyphens
UPPER_CASEMAXRETRIESAll uppercase; often no separator (for short constants)
dot.caseget.user.by.idLowercase; words separated by dots (less common)

Which Language Uses Which Convention?

1

JavaScript and TypeScript

// Variables and functions — camelCase
const userId = "abc123";
function getUserProfile() { }

// Classes and interfaces — PascalCase
class UserProfile { }
interface ApiResponse { }

// Constants — SCREAMING_SNAKE_CASE
const MAX_RETRY_COUNT = 3;

// CSS classes — kebab-case
// .user-profile-card { ... }
ElementConventionExample
VariablescamelCasefirstName, isLoggedIn, totalPrice
FunctionscamelCasecalculateTotal(), fetchUserData()
ClassesPascalCaseUserAccount, ProductCart
ConstantsSCREAMING_SNAKE_CASEAPI_BASE_URL, MAX_ITEMS
React componentsPascalCaseLoginButton, NavBar
CSS / HTML attributeskebab-casebackground-color, data-user-id
2

Python

# Variables and functions — snake_case
user_name = "Mihad"
def get_user_profile(): pass

# Classes — PascalCase
class UserProfile:
  pass

# Constants — SCREAMING_SNAKE_CASE
MAX_RETRIES = 3

# Private/internal — leading underscore
_internal_cache = {}

Python's PEP 8 style guide is explicit: snake_case for everything except classes. This is one of the most consistent naming schemes in any major language, and following it is expected in any professional Python codebase.

3

Dart and Flutter

// Variables and functions — camelCase
String userName = 'Mihad';
void fetchUserData() { }

// Classes and widgets — PascalCase
class LoginScreen extends StatefulWidget { }

// Files — snake_case
// login_screen.dart, user_model.dart

// Constants — lowerCamelCase (Dart convention)
const kPrimaryColor = Colors.green;
ElementConventionExample
Variables, functionscamelCaseuserName, fetchData()
Classes, Widgets, EnumsPascalCaseLoginScreen, UserModel
File namessnake_caselogin_screen.dart
Constants (Flutter style)kCamelCasekPrimaryColor, kMaxItems
Library/package namessnake_caseflutter_bloc, get_it
4

Java and Kotlin

// Variables and methods — camelCase
String firstName = "Mihad";
void getUserById(int id) { }

// Classes — PascalCase
class UserRepository { }

// Constants — SCREAMING_SNAKE_CASE
static final int MAX_CONNECTIONS = 10;
5

HTML, CSS, and URLs

Web technologies almost universally use kebab-case — hyphens instead of underscores. This is because underscores in URLs and CSS selectors can cause issues with certain parsers and search engines.

/* CSS — kebab-case */
.user-profile-card { background-color: #fff; }

<!-- HTML attributes — kebab-case -->
<div data-user-id="123" class="nav-bar">

// URLs — kebab-case
rankstreak.in/word-counter-online-free/
// NOT rankstreak.in/word_counter_online_free/
📌 SEO Note: Google treats hyphens as word separators in URLs but treats underscores as joiners. /word-counter/ is indexed as "word counter" (two separate words), while /word_counter/ is indexed as "word_counter" (one joined term). Always use hyphens in URLs for better SEO.

Master Reference: Case Convention by Language

LanguageVariables/FunctionsClassesConstantsFiles
JavaScriptcamelCasePascalCaseSCREAMING_SNAKEcamelCase or kebab
TypeScriptcamelCasePascalCaseSCREAMING_SNAKEcamelCase or kebab
Pythonsnake_casePascalCaseSCREAMING_SNAKEsnake_case
Dart / FluttercamelCasePascalCasekCamelCasesnake_case
JavacamelCasePascalCaseSCREAMING_SNAKEPascalCase
KotlincamelCasePascalCaseSCREAMING_SNAKEPascalCase
C#camelCasePascalCasePascalCasePascalCase
GocamelCasePascalCasePascalCasesnake_case
Rubysnake_casePascalCaseSCREAMING_SNAKEsnake_case
PHPcamelCasePascalCaseSCREAMING_SNAKEsnake_case
CSSkebab-caseN/AN/Akebab-case
SQLsnake_caseN/AUPPER_CASEsnake_case

How Case Converters Help Developers Day-to-Day

Scenario 1: Converting API Response Keys

REST APIs often return JSON in snake_case (Python/Ruby backend convention), but your JavaScript frontend expects camelCase. Converting user_first_nameuserFirstName across dozens of fields is tedious to do manually. A case converter handles it in one paste.

Scenario 2: Renaming Variables During Refactoring

When refactoring code or switching frameworks (e.g., from plain JS to React, or from Python to Dart), variable naming conventions change. Converting a list of variable names from snake_case to camelCase in bulk saves significant time.

Scenario 3: Converting Content to URL Slugs

Blog titles need to become URL slugs. "How to Use an Online Case Converter" → "how-to-use-an-online-case-converter". Converting to lowercase and then replacing spaces with hyphens is exactly what a case converter's lowercase mode does, getting you 80% of the way there.

Scenario 4: Database Column Naming

Database columns are typically snake_case. When mapping database columns to ORM model properties (which are often camelCase in application code), quickly converting between the two speeds up the mapping process.

🔤 Convert Text Case Instantly — Free

Sentence case, Title Case, UPPERCASE, lowercase — paste and convert in one click.

Open Case Converter →

Frequently Asked Questions

❓ Does it actually matter which case convention I use?

Yes — significantly. In most languages, using the wrong convention doesn't break your code (except in specific cases like Python private attributes or Go's exported/unexported distinction), but it marks you as someone unfamiliar with the language's ecosystem. In professional and open-source codebases, consistent naming conventions are enforced by linters (ESLint, Pylint, dartanalyze) and code reviewers.

❓ Why does Python use snake_case instead of camelCase?

It's a design philosophy choice. Python's creator Guido van Rossum and PEP 8 (Python's style guide) standardised snake_case for readability — lowercase with underscores is considered easier to read for longer names like calculate_total_user_score vs calculateTotalUserScore. There's no technical reason one works better than the other; it's a community convention.

❓ What is the difference between PascalCase and camelCase?

Both capitalise the first letter of each word, but PascalCase also capitalises the very first letter: UserProfile. camelCase starts lowercase: userProfile. PascalCase is also called UpperCamelCase, while camelCase is sometimes called lowerCamelCase.

❓ Which case convention is best for SEO in URLs?

kebab-case is best for URLs. Google treats hyphens as word separators (so "word-counter" is indexed as two separate words), making your pages more discoverable. Underscores join words together ("word_counter" is one term to Google). Uppercase letters in URLs create duplicate content risk. Always use lowercase kebab-case for URLs and slugs.

Conclusion

Naming conventions are the silent language of programming — they communicate intent, ownership, and context without a single comment. Mastering them makes your code more readable, more professional, and easier to maintain.

Quick cheat sheet to remember:

  • camelCase → JavaScript/TypeScript variables and functions, Dart/Flutter variables
  • PascalCase → Classes in almost every language, React components
  • snake_case → Python everything, database columns, file names in Python/Dart/Ruby
  • SCREAMING_SNAKE_CASE → Constants in most languages
  • kebab-case → CSS classes, HTML attributes, URLs, file names in web projects
🎯 Quick conversion: When you need to switch case format for any text, the RankStreak Case Converter handles lowercase and Title Case conversions instantly — a useful starting point for manual kebab or snake_case formatting.