camelCase, snake_case, kebab-case: a developer's naming guide
When you're naming variables, functions, classes, or URLs, the format you choose matters. Different languages and contexts have different conventions: JavaScript uses camelCase, Python prefers snake_case, CSS properties use kebab-case, and configuration constants use CONSTANT_CASE. Understanding each one and knowing how to convert between them is a practical skill that keeps your code consistent and readable.
camelCase: the JavaScript standard
camelCase starts with a lowercase letter and capitalizes the first letter of each subsequent word, with no separators. Variables and function names in JavaScript follow this pattern: getUserById, calculateTotalPrice, handleSubmitClick. Most JSON keys are also camelCase by convention.
The name comes from the "humps" the capital letters create. It's compact, readable, and the de facto standard across JavaScript, TypeScript, Java, and C#. When you need to convert text into camelCase—whether you're building a code generator or standardizing variable names—the case converter handles it in one paste.
snake_case: Python and databases
snake_case joins words with underscores and keeps all letters lowercase: get_user_by_id, calculate_total_price, handle_submit_click. Python developers use this for variable and function names, as per PEP 8 style guidelines. SQL column and table names also commonly use snake_case, as do environment variables in most systems.
snake_case is readable even in all-caps form (DATABASE_PASSWORD, MAX_RETRY_COUNT), which is why CONSTANT_CASE—uppercase snake_case—is the universal convention for configuration constants and final variables across every language.
kebab-case: URLs and CSS
kebab-case joins words with hyphens and uses all lowercase: get-user-by-id, calculate-total-price. You see it everywhere in URLs—article slugs, product pages, route names—because hyphens are friendly to search engines and less likely to be misinterpreted by parsers than underscores. CSS class names and custom HTML attributes also use kebab-case by convention.
Building URL-safe identifiers or slug-like names from plain text is one of the most practical uses. The slug generator converts phrases into URL-ready kebab-case strings, stripping punctuation and accents along the way.
PascalCase: classes and types
PascalCase (or UpperCamelCase) capitalizes the first letter: GetUserById, CalculateTotalPrice. It's the convention for class names, type definitions, and components in TypeScript, C#, Java, and React. When you're working with object-oriented languages or component frameworks, this is what you'll reach for.
Converting between formats
Converting from one convention to another requires two steps: first split the identifier into separate words, then rejoin them with the target separator and casing. That's where tools streamline the process.
If you have a camelCase identifier and need to understand its parts—perhaps to rename it or match a snake_case version—the split camelCase tool breaks it apart: getUserById becomes get User By Id. Once the words are separated, the case converter can reformat them in any convention you need. Developers also use these tools when refactoring code across language boundaries or when translating between API specs and internal variable names.
When to use each convention
The right choice depends on context, not preference. JavaScript and JSON use camelCase. Python, SQL, and environment variables use snake_case. URLs and CSS use kebab-case. Type and class names use PascalCase. Configuration constants use CONSTANT_CASE across all languages. Following these conventions makes your code instantly recognizable to anyone familiar with that ecosystem.
Consistency matters more than the specific convention—if you mix formats in the same file or project, readers have to context-switch and mistakes become easier. Tools to convert and split identifiers help you stay consistent when you're working across multiple languages or migrating code between projects.