Text Case and Naming Style Conversion Guide: camelCase, snake_case, and More
Why Naming Style Matters
Consistent naming style is the foundation of code readability:
- Reduces cognitive load in team collaboration
- Following language/framework conventions makes code idiomatic
- Automated conversion saves manual editing time
- Style adaptation is needed when migrating code across languages
Common Naming Styles at a Glance
| Style | Example | Common Languages/Contexts |
|---|---|---|
| camelCase | userName |
JavaScript, Java, TypeScript |
| PascalCase | UserService |
C#, class/component names |
| snake_case | user_name |
Python, Ruby, SQL |
| kebab-case | user-name |
HTML attributes, CSS, URLs |
| SCREAMING_SNAKE | MAX_RETRY |
Constants, environment variables |
| dot.case | user.name |
Config files, nested properties |
Conversion Rules Explained
camelCase → Other Styles
Input:getUserInfoById
→ PascalCase: GetUserInfoById
→ snake_case: get_user_info_by_id
→ kebab-case: get-user-info-by-id
→ SCREAMING: GET_USER_INFO_BY_ID
PascalCase → Other Styles
Input:UserService
→ camelCase: userService
→ snake_case: user_service
→ kebab-case: user-service
→ SCREAMING: USER_SERVICE
snake_case → Other Styles
Input:created_at
→ camelCase: createdAt
→ PascalCase: CreatedAt
→ kebab-case: created-at
→ SCREAMING: CREATED_AT
Core logic: Split by delimiters (
_,-, case boundaries) into words, then rejoin in the target style.
Language Naming Conventions
| Language | Variables | Functions | Classes | Constants |
|---|---|---|---|---|
| JavaScript | camelCase | camelCase | PascalCase | SCREAMING_SNAKE |
| Python | snake_case | snake_case | PascalCase | SCREAMING_SNAKE |
| Java | camelCase | camelCase | PascalCase | SCREAMING_SNAKE |
| Go | camelCase | camelCase | PascalCase | SCREAMING_SNAKE |
| Rust | snake_case | snake_case | PascalCase | SCREAMING_SNAKE |
| CSS | — | — | kebab-case | — |
Using the Case Conversion Tool
Step 1: Open the Tool
Visit the Case Conversion tool.
Step 2: Enter Text
Paste the variable name, function name, or any text you want to convert.
Step 3: Choose Target Style
The tool supports one-click conversion to:
- camelCase (lower camelCase)
- PascalCase (upper camelCase)
- snake_case (underscore)
- kebab-case (hyphen)
- SCREAMING_SNAKE (constant)
- dot.case (dot-separated)
Step 4: Copy the Result
Click the copy button and paste directly into your code editor.
Batch Conversion Tips
Need to convert naming styles across a whole codebase?
- Enter all identifiers line by line in the Case Conversion tool
- Or use the Text Lines tool to process multiple lines at once
- Combine with the Slug tool to generate URL-friendly path names
Edge Cases and Caveats
| Case | Input | Output (camelCase) | Notes |
|---|---|---|---|
| Consecutive uppercase acronyms | XMLParser |
xmlParser |
Acronyms treated as one word |
| Trailing number | user2FA |
user2Fa |
Uppercase after digit = new word |
| Already delimited | user_name_id |
userNameId |
Split first, then merge |
| All uppercase | MAX_SIZE |
maxSize |
Constant to variable |
Tip: Different tools may split acronyms (XML, HTTP, URL) differently. Always review the result.
Common Issues
| Issue | Cause | Solution |
|---|---|---|
| Wrong conversion result | Different acronym splitting strategy | Manually adjust acronym parts |
| Lost delimiter info | username could be userName or user_name |
Preserve original delimiters |
| Mixed with CJK | No case in Chinese/Japanese | Only convert the English parts |
| First letter issue | camelCase requires lowercase first letter | Confirm the target style is correct |
Summary
Mastering naming style conversion is a fundamental skill for cross-language development. The Case Conversion tool lets you switch between camelCase, PascalCase, snake_case, kebab-case, and more with one click. Combined with the Lines tool and Slug tool, you can efficiently adapt code styles across projects.