Converters

Programming Naming Conventions: camelCase, snake_case, PascalCase & More

Complete guide to programming naming conventions. Learn when to use camelCase, snake_case, PascalCase, kebab-case, and CONSTANT_CASE with language-specific rules for JavaScript, Python, Go, Java, CSS, and more.

Published March 20, 2026
15 minute read
Cryptography Guide

Programming Naming Conventions: camelCase, snake_case, PascalCase & More

Naming conventions are one of the first things every developer needs to learn -- and one of the most common sources of inconsistency in codebases. Using the wrong case style does not cause syntax errors, but it signals unfamiliarity with a language's idioms and makes code harder to read for experienced developers.

This guide covers every major naming convention, when to use each one, and the specific rules for 10 programming languages. Use our free case converter to instantly transform text between all these formats.

The Major Naming Conventions

camelCase

Pattern: First word lowercase, subsequent words capitalized. No separators.

myVariableName
calculateTotalPrice
getUserById
isAuthenticated

Where it's used: JavaScript/TypeScript variables and functions, Java variables and methods, JSON property names, Swift variables and functions.

Why it's called camelCase: The capital letters in the middle of the word resemble the humps of a camel.

PascalCase (UpperCamelCase)

Pattern: Every word capitalized, including the first. No separators.

MyClassName
UserProfile
HttpRequestHandler
DatabaseConnection

Where it's used: Class names in nearly all languages, React/Vue/Angular component names, TypeScript interfaces and types, C# everything (methods, properties, classes).

Key difference from camelCase: The first letter is capitalized. myFunction (camelCase) vs MyFunction (PascalCase).

snake_case

Pattern: All lowercase, words separated by underscores.

my_variable_name
calculate_total_price
get_user_by_id
is_authenticated

Where it's used: Python variables, functions, and module names (PEP 8), Ruby variables and methods, Rust variables and functions, database column and table names, file names in many projects.

SCREAMING_SNAKE_CASE (CONSTANT_CASE)

Pattern: All uppercase, words separated by underscores.

MAX_RETRY_COUNT
DATABASE_URL
API_BASE_URL
DEFAULT_TIMEOUT_MS

Where it's used: Constants in most languages, environment variables, C/C++ preprocessor macros, Java static final fields.

kebab-case (dash-case)

Pattern: All lowercase, words separated by hyphens.

my-component-name
user-profile-card
border-bottom-color
my-awesome-package

Where it's used: CSS class names and properties, HTML attributes (data-*), URL slugs, npm package names, file names in many frameworks, Lisp/Clojure function names.

Note: kebab-case cannot be used for variable names in most programming languages because the hyphen is interpreted as a minus operator.

dot.case

Pattern: All lowercase, words separated by dots.

com.example.myapp
log.level.debug
spring.datasource.url

Where it's used: Java package names, configuration keys (Spring Boot, .properties files), C# namespaces, domain names.

Train-Case (HTTP-Header-Case)

Pattern: Every word capitalized, separated by hyphens.

Content-Type
X-Request-Id
Accept-Language
Cache-Control

Where it's used: HTTP headers, MIME types. This is the only common naming convention that capitalizes words while using hyphens.

Language-Specific Rules

JavaScript / TypeScript

ElementConventionExample
VariablescamelCaselet userName = "John"
FunctionscamelCasefunction getUserData()
ClassesPascalCaseclass UserProfile
Interfaces (TS)PascalCaseinterface ApiResponse
Type aliases (TS)PascalCasetype UserId = string
ConstantsCONSTANT_CASEconst MAX_RETRIES = 3
Enum members (TS)PascalCaseenum Color { Red, Blue }
React componentsPascalCasefunction UserCard()
CSS modulescamelCasestyles.headerContainer
File nameskebab-case or camelCaseuser-profile.ts
npm packageskebab-casemy-awesome-lib

Python

ElementConventionExample
Variablessnake_caseuser_name = "John"
Functionssnake_casedef get_user_data():
ClassesPascalCaseclass UserProfile:
ConstantsCONSTANT_CASEMAX_RETRIES = 3
Modulessnake_caseimport user_utils
Packageslowercase (no separators)import mypackage
Private members_leading_underscoreself._internal_data
Name mangling__double_leadingself.__private_var
Dunder methodsdouble_bothdef __init__(self):

Python's naming conventions are defined in PEP 8, which is the universally accepted style guide.

Java

ElementConventionExample
VariablescamelCaseString userName
MethodscamelCasegetUserData()
ClassesPascalCaseclass UserProfile
InterfacesPascalCaseinterface Serializable
ConstantsCONSTANT_CASEstatic final int MAX_RETRIES
Packageslowercase.dot.separatedcom.example.myapp
Enum valuesCONSTANT_CASEenum Status { ACTIVE, INACTIVE }

Go

ElementConventionExample
Exported (public)PascalCasefunc GetUser(), type Config struct
Unexported (private)camelCasefunc parseInput(), var count int
ConstantsPascalCase or camelCaseconst MaxRetries = 3
Packageslowercase (single word)package http
InterfacesPascalCase + -er suffixtype Reader interface
AcronymsALL CAPSuserID, httpURL, sqlDB

Go uses capitalization for visibility -- exported identifiers start with an uppercase letter, unexported ones with lowercase. This is enforced by the compiler, not just convention.

CSS

ElementConventionExample
Propertieskebab-casebackground-color: red
Class nameskebab-case.user-profile-card
BEM notationblock__element--modifier.card__title--active
CSS custom propertieskebab-case with -- prefix--primary-color: blue
Sass variableskebab-case with $$font-size-large
Tailwind classeskebab-casetext-sm, bg-blue-500

Rust

ElementConventionExample
Variablessnake_caselet user_name = "John"
Functionssnake_casefn get_user_data()
Structs/EnumsPascalCasestruct UserProfile
ConstantsSCREAMING_SNAKE_CASEconst MAX_RETRIES: u32 = 3
Modulessnake_casemod user_utils
TraitsPascalCasetrait Serialize
Crate nameskebab-case (Cargo.toml) / snake_case (code)my-crate / my_crate

SQL

ElementConventionExample
KeywordsUPPERCASESELECT, FROM, WHERE
Table namessnake_case (singular or plural)user_profile or user_profiles
Column namessnake_casefirst_name, created_at
Indexesix_ prefixix_users_email
Foreign keysfk_ prefixfk_orders_user_id

Common Conversion Patterns

When working across languages or systems, you frequently need to convert between naming conventions:

From → ToWhen
camelCase → kebab-caseJS property → CSS class name
camelCase → snake_caseJS/Java → Python/Ruby/Database
snake_case → camelCaseDatabase/API → JavaScript
PascalCase → kebab-caseComponent name → file name
kebab-case → camelCaseCSS property → JS style property
CONSTANT_CASE → camelCaseEnvironment variable → config object

Example: A JSON API might return user_name (snake_case), but your JavaScript code uses userName (camelCase), your CSS uses .user-name (kebab-case), and your React component is UserName (PascalCase) -- all representing the same concept.

Use our case converter to instantly convert between all these formats without manual retyping.

Acronyms and Abbreviations

Acronyms in identifiers are handled differently across languages:

LanguageRuleExample
JavaScriptCapitalize only first letteruserId, htmlParser, apiUrl
GoKeep all capsuserID, htmlParser, apiURL
C#2-letter acronyms: all caps; 3+: PascalCaseIOStream, HtmlParser
JavaCapitalize only first letteruserId, httpUrl
PythonLowercase in snake_caseuser_id, html_parser, api_url

The inconsistency around acronyms is one of the most debated style issues. The most important thing is consistency within your project.

File Naming Conventions

Language/FrameworkConventionExample
JavaScript/TypeScriptkebab-case or camelCaseuser-profile.ts, userProfile.ts
React componentsPascalCaseUserProfile.tsx
Pythonsnake_caseuser_profile.py
JavaPascalCase (matches class)UserProfile.java
Golowercaseuserprofile.go
CSS/SCSSkebab-caseuser-profile.css
TestsSame + .test/.specuser-profile.test.ts

Style Guide References

LanguageOfficial Style Guide
PythonPEP 8
JavaScriptAirbnb / Google / StandardJS
TypeScriptGoogle TypeScript Style Guide
JavaGoogle Java Style Guide
GoEffective Go (enforced by gofmt)
RustRust API Guidelines
C#.NET Naming Guidelines
SwiftSwift API Design Guidelines
RubyRuby Style Guide
PHPPSR-12

Frequently Asked Questions

Does naming convention affect code execution?

In most languages, no -- myVar and my_var are both valid. The exception is Go, where capitalization determines visibility: MyFunc is exported (public), myFunc is unexported (private). In CSS, class names are case-sensitive, so .MyClass and .myclass are different selectors.

Which naming convention is "best"?

There is no universally best convention. Follow the established convention for your language. Using snake_case in JavaScript or camelCase in Python will work, but it will confuse other developers and violate community expectations. Consistency within a project matters more than the specific choice.

How do linters enforce naming conventions?

ESLint (JavaScript) has the camelcase rule. Pylint (Python) enforces PEP 8 naming. RuboCop (Ruby) checks naming style. Go's compiler enforces export rules by capitalization. Most linters can be configured to match your project's specific naming requirements.


Need to convert text between naming conventions? Use our case converter to instantly transform between camelCase, snake_case, PascalCase, kebab-case, and more. For counting characters and words in your code, try our word counter.

About This Article

This article is part of our comprehensive converters cipher tutorial series. Learn more about classical cryptography and explore our interactive cipher tools.

More Converters Tutorials

Try Converters Cipher Tool

Put your knowledge into practice with our interactive convertersencryption and decryption tool.

Try Converters Tool