Case Converter
Convert text between camelCase, snake_case, kebab-case, and many more case styles.
What is Case Conversion?
Case conversion is the process of transforming text from one naming convention to another. In programming, different languages and contexts have established conventions for how to name variables, functions, classes, and constants. Converting between these styles is a common task when working across languages or refactoring code.
This tool instantly converts your text to 11 different case styles, making it easy to adapt identifiers for any programming language or coding standard.
Case Styles Explained
camelCase
First word lowercase, subsequent words capitalized, no separators. Example: getUserData
Used in: JavaScript variables/functions, Java methods, TypeScript, Swift
PascalCase (UpperCamelCase)
Every word capitalized, no separators. Example: UserAccount
Used in: Class names in most languages, C# methods, React components, TypeScript types
snake_case
All lowercase with underscores between words. Example: user_account
Used in: Python, Ruby, Rust, database column names, PHP
SCREAMING_SNAKE_CASE
All uppercase with underscores. Example: MAX_RETRY_COUNT
Used in: Constants in most languages, environment variables, configuration keys
kebab-case
All lowercase with hyphens between words. Example: user-profile
Used in: URLs, CSS classes, HTML attributes, npm package names, CLI commands
dot.case
All lowercase with dots between words. Example: user.profile.settings
Used in: Java package names, configuration files, logging namespaces
path/case
All lowercase with forward slashes. Example: user/profile/settings
Used in: File paths, URL paths, module paths
When to Use Each Case Style
| Context | Recommended Case |
|---|---|
| JavaScript variables | camelCase |
| JavaScript/TypeScript classes | PascalCase |
| Python functions/variables | snake_case |
| Python classes | PascalCase |
| Constants (any language) | SCREAMING_SNAKE_CASE |
| CSS classes | kebab-case |
| Database columns | snake_case |
| REST API endpoints | kebab-case or snake_case |
| Environment variables | SCREAMING_SNAKE_CASE |
Why Naming Conventions Matter
- Readability: Consistent naming makes code easier to read and understand at a glance.
- Maintainability: When everyone follows the same conventions, code is easier to maintain.
- Language conventions: Following language-specific conventions helps your code fit in with the ecosystem.
- Team standards: Agreed-upon naming conventions reduce code review friction.
- Tooling compatibility: Some tools and frameworks expect specific naming conventions.
Language-Specific Conventions
- JavaScript/TypeScript: camelCase for variables/functions, PascalCase for classes/components, SCREAMING_SNAKE_CASE for constants.
- Python: snake_case for functions/variables/modules, PascalCase for classes, SCREAMING_SNAKE_CASE for constants.
- Java: camelCase for methods/variables, PascalCase for classes, SCREAMING_SNAKE_CASE for constants.
- Ruby: snake_case for methods/variables, PascalCase for classes/modules, SCREAMING_SNAKE_CASE for constants.
- Go: camelCase for private, PascalCase for exported identifiers.
- CSS: kebab-case for class names and custom properties.
Common Use Cases
- API response transformation: Convert snake_case API responses to camelCase for JavaScript frontend code.
- Database to code: Transform database column names to your language's preferred convention.
- CSS class generation: Convert component names to kebab-case for CSS class names.
- Environment variables: Transform config keys to SCREAMING_SNAKE_CASE for environment variables.
- URL slugs: Convert titles or names to kebab-case for URL-friendly slugs.
How This Tool Works
The converter automatically detects word boundaries in your input text by looking for:
- Transitions from lowercase to uppercase (camelCase detection)
- Common separators: underscores, hyphens, dots, slashes, and spaces
- Consecutive uppercase letters followed by lowercase (for acronyms like "XMLParser")
Once words are identified, they're reassembled using each target format's rules.
Privacy & Security
This case converter runs entirely in your browser. Your text is never sent to any server or stored. All processing happens locally using JavaScript, making it safe to use with code snippets, variable names, or any sensitive text.
Frequently Asked Questions
Can I convert multiple lines at once?
Currently, the tool works best with single identifiers or short phrases. For bulk conversion, process each identifier separately.
How are acronyms handled?
Acronyms are treated as single words. "XMLParser" becomes "xml-parser" in kebab-case and "xml_parser" in snake_case.
What about numbers in identifiers?
Numbers are preserved and kept attached to the preceding word. "user2data" stays together as one unit.
Which case should I use for JSON keys?
It depends on your backend. JavaScript/Node.js typically use camelCase, while Python/Ruby APIs often use snake_case. Be consistent within your API.