tooliv

Case Converter

UPPER, lower, camelCase conversion

Input

Result

Case Conversion for Developers: camelCase, snake_case, and Friends

Every programming language has its own opinion about how to name things. JavaScript loves camelCase, Python insists on snake_case, and CSS goes with kebab-case. Switching between them by hand is tedious and error-prone -- a case converter handles it in seconds.

Which Case Style Goes Where

UPPER CASE for constants, Title Case for headings, camelCase for JS variables and functions, PascalCase for class names, snake_case for Python and databases, kebab-case for CSS classes and URLs. Use the wrong one and your code review will hear about it.

Picking the Right Case for the Job

Writing JavaScript or Java? Variables and functions go in camelCase (like getUserName). Class names and React components get PascalCase (like UserProfile). Working in Python? Everything is snake_case (get_user_name) except classes, which use PascalCase. CSS classes and URL slugs live in kebab-case (user-profile-card). Constants across most languages use UPPER_SNAKE_CASE (MAX_RETRIES). Getting these right isn't just about style -- it makes code instantly recognizable.

What Each Language's Style Guide Says

JavaScript and TypeScript: camelCase for variables, PascalCase for classes, UPPER_SNAKE_CASE for constants. Python (PEP 8): snake_case for variables and functions, PascalCase for classes. CSS: kebab-case for class names. Java: camelCase for methods, lowercase for packages. Go has its own twist -- PascalCase makes a function public (exported), while camelCase keeps it private. These aren't arbitrary rules; they're how other developers reading your code know what's what at a glance.

Naming Conventions: The Stuff That Separates Clean Code From Messy Code

Pick a convention and stick with it throughout the project. Nothing kills readability faster than mixing camelCase and snake_case in the same file. Name things clearly -- userAge beats uA every time. Set up ESLint, Pylint, or whatever linter your language uses to catch naming inconsistencies automatically. If you're joining an existing project, follow whatever conventions are already there, even if you'd prefer something different. Consistency always wins over personal preference.

Frequently Asked Questions

What is camelCase?

Words joined with first letter capitalized except the first. Example: myVariableName

What's the difference between PascalCase and camelCase?

PascalCase also capitalizes the first letter. Example: MyVariableName

When to use snake_case?

Common in Python, Ruby, database column names, and file naming.

Related Tools