Case Converter: Convert CamelCase, Snake_case & More
Naming variables is one of the two hardest things in programming (right after cache invalidation). And once you come up with a name, you have to write it correctly, as every programming language has different rules.
Our Case Converter is a Swiss Army knife for text formatting. Just type a name once (in any format), and we’ll instantly “translate” it into the syntax of all major programming languages.
Quick Overview: When to Use Which Case?
If you’re confused, here’s a cheat sheet of standard naming conventions for 2025:
🐪 camelCase (Camel Notation)
Starts with a lowercase letter, and each subsequent word begins with an uppercase letter. No spaces.
- Where it’s used: JavaScript, Java, Swift, Kotlin, Go.
- Examples:
myVariableName,getElementById,iPhone.
🐍 snake_case (Snake Notation)
All letters are lowercase and separated by underscores.
- Where it’s used: Python, Rust, PHP, SQL databases, file names.
- Examples:
user_id,first_name,def my_function().
🍢 kebab-case (Kebab Notation)
Lowercase letters separated by hyphens. Looks like meat on a skewer.
- Where it’s used: CSS classes, HTML attributes, URLs (slugs), Kubernetes.
- Examples:
font-size,my-cool-article,<div id="main-content">.
📐 PascalCase (UpperCamelCase)
Similar to camelCase, but the first letter is uppercase.
- Where it’s used: Class names in most languages (JS, Python, PHP), C# (methods and variables), React components.
- Examples:
UserProfile,AppController,ReactComponent.
📢 CONSTANT_CASE (Screaming Snake Case)
Uppercase letters separated by underscores. It screams at you that this value should not change.
- Where it’s used: Constants, ENV variables, global configurations.
- Examples:
MAX_RETRIES,API_KEY,DB_PASSWORD.
How Does Our Converter Work?
Our tool is “smart.” This means it doesn’t just blindly replace spaces.
- Word Detection: The algorithm recognizes words, whether they are separated by spaces
hello world, underscoreshello_world, hyphenshello-world, or changes in capitalizationhelloWorld. - Normalization: It converts everything to a base form.
- Generation: It assembles all variants at once.
This is useful, for example, when refactoring code, where you might need to convert old PHP variables ($user_id) to modern JavaScript (userId) or create a CSS class (user-id) from a database column name.
FAQ: Frequently Asked Questions
What is "Hungarian notation"?
This is an older naming convention (common in C/C++ in the 90s) where a variable name starts with an abbreviation of its data type. For example,strName (string) or iCount (integer). It's not widely used in modern languages today because IDEs automatically show us the types.
Can I use kebab-case in JavaScript?
Not directly as a variable name, because the hyphen- acts as a subtraction operator in JS. var my-variable would mean "my minus variable." Kebab-case is only used in JS as keys in objects, if they are in quotes: { "content-type": "json" }.
Which case should I use for JSON?
The JSON standard doesn't specify a case, but Google and most REST APIs use camelCase (e.g.,createdAt). Conversely, some older APIs and Python backends return snake_case (e.g., created_at). It's important to be consistent.