Developer Academy · Beginner

camelCase to snake_case: Naming Styles & Examples

Learn the difference between camelCase, PascalCase, snake_case, kebab-case and CONSTANT_CASE, see practical examples, and convert text with the Editagram Case Converter.

6 min read By Editagram Team Updated
casecamelcasesnake-casedeveloper

What is text case conversion?

Case conversion changes how words are capitalized and separated. Developers use naming conventions to make variables, functions, components, CSS classes and constants easier to recognize. A consistent style also reduces avoidable differences between files and APIs.

camelCase: start lowercase, capitalize later words

camelCase joins words without spaces and starts with a lowercase letter. For example, "user profile name" becomes "userProfileName". It is common for JavaScript variables, function names and object properties.

PascalCase: capitalize every word

PascalCase also joins words, but the first word begins with an uppercase letter: "UserProfileName". It is commonly used for class names, type names and React component names. Follow the naming convention of the language or project you are working in.

snake_case: separate words with underscores

snake_case uses lowercase words separated by underscores, such as "user_profile_name". It is common in Python variable and function names, database columns and configuration keys, although individual projects may choose other conventions.

kebab-case and CONSTANT_CASE

kebab-case uses lowercase words separated by hyphens, as in "user-profile-name". It is widely used for CSS class names, URL slugs and command-line options. CONSTANT_CASE uses uppercase words separated by underscores, for example "MAX_RETRY_COUNT", and is often used for constants in languages and codebases that follow that convention.

Quick comparison with the same words

For the phrase "user profile name", the common outputs are userProfileName (camelCase), UserProfileName (PascalCase), user_profile_name (snake_case), user-profile-name (kebab-case) and USER_PROFILE_NAME (CONSTANT_CASE). The words stay the same; capitalization and separators change.

tip

Choose a convention that fits the project

Use the convention expected by your programming language, framework, API or existing codebase. A JavaScript variable may use camelCase while a React component uses PascalCase. A URL slug may use kebab-case even when the application variable is camelCase. Consistency within the same context matters more than choosing one style for every situation.

Convert text with Editagram

Open the Case Converter, paste or type your text, then choose UPPERCASE, lowercase, Title Case, Sentence case, camelCase, PascalCase, snake_case, kebab-case or CONSTANT_CASE. Review the result before copying it into code. Automated conversion cannot always infer acronyms, product names or domain-specific capitalization, so check those cases manually.

Frequently Asked Questions

What is the difference between camelCase and snake_case?

camelCase joins words and capitalizes later words without separators, such as userProfileName. snake_case uses lowercase words separated by underscores, such as user_profile_name.

Is kebab-case the same as snake_case?

No. kebab-case separates lowercase words with hyphens, while snake_case uses underscores.

Which naming style should I use in JavaScript?

camelCase is common for variables and functions, while PascalCase is common for classes and React components. Follow the conventions already used by your project.

Can automatic conversion handle every acronym correctly?

Not always. A converter applies consistent text rules, but acronyms, product names and specialist terms may need a manual review.

Related Tools

  • Case Converter

    Convert text to upper, lower, title, sentence, camel and more.

Related Guides

Explore more learning resources in Editagram Academy.