camelCase, snake_case, PascalCase: When to Use Which Naming Convention
Every programming language has opinions about naming, and no single convention wins universally. You'll encounter camelCase in JavaScript, snake_case in Python and SQL, PascalCase for class names, and kebab-case in CSS and URLs — often all in the same project. Knowing which to use where (and how to convert between them quickly) keeps your code consistent and your teammates happy.
camelCase: The JavaScript Default
camelCase starts lowercase and capitalizes every subsequent word: firstName, getUserById, isLoading. It's the standard for variables and functions in JavaScript, TypeScript, Java, and Swift. The name comes from the capital letters resembling humps on a camel. camelCase is compact — no separators add length — and reads naturally in languages where whitespace isn't syntactically meaningful.
PascalCase: For Classes and Components
PascalCase (also called UpperCamelCase) capitalizes the first letter too: UserProfile, ProductCard, AuthService. It's universally used for class names and constructors in most languages, and for React component names specifically — React uses the capitalization to distinguish user-defined components from native HTML elements. If you name a React component button, React treats it as an HTML button. Name it Button and it's your custom component.
snake_case: Python, SQL, and File Names
snake_case separates words with underscores and keeps everything lowercase: user_id, created_at, get_product_list. Python style guides (PEP 8) require it for variables, functions, and module names. SQL column names are almost always snake_case by convention. It's also common for file names in Unix environments because spaces in file names cause headaches in scripts and command lines. SCREAMING_SNAKE_CASE (all caps) is the standard for constants:MAX_RETRY_COUNT, API_BASE_URL.
kebab-case: URLs and CSS
kebab-case uses hyphens as separators, all lowercase: my-component, font-size, /blog/my-first-post. CSS properties use it exclusively. URL slugs use it because hyphens are treated as word separators by search engines — Google treats my-blog-post as three separate words, while underscores in URLs are sometimes treated as joining characters. This makes kebab-case the SEO-preferred format for URL paths. In JavaScript, kebab-case identifiers aren't valid variable names (hyphens are subtraction operators), so you'll see it used mainly in HTML attributes and CSS.
Quick Reference: Which Convention for What
As a practical rule: use camelCase for variables and functions in JavaScript/TypeScript; PascalCase for classes and React components; snake_case for Python functions, variables, and SQL columns; kebab-case for CSS classes, URL slugs, and HTML data attributes; SCREAMING_SNAKE_CASE for constants and environment variables. When in doubt, check your language's official style guide — PEP 8 for Python, Google Style Guides for Java and C++, Airbnb or StandardJS for JavaScript.
Converting Between Cases Instantly
When you're migrating an API response to a codebase with different conventions, or reformatting a batch of variable names from a legacy system, manual conversion is tedious and error-prone. Our Case Converter transforms text between camelCase, PascalCase, snake_case, kebab-case, SCREAMING_SNAKE_CASE, Title Case, and more in one click. Paste any text — a list of variable names, a sentence, or a block of identifiers — and every case variant is generated instantly, all in your browser with no upload needed.