What is a "case" and why do programming languages care?
"Case" in programming refers to the letter casing convention used for compound identifiers — variable names, function names, file names, URL paths. The same conceptual identifier ("user profile picture") can be written as userProfilePicture, user_profile_picture, user-profile-picture, UserProfilePicture, or USER_PROFILE_PICTURE depending on the convention. Each convention emerged from specific language constraints and community preferences over decades, and most modern style guides treat consistency as a hard requirement.
Why this matters: a 2026 developer touches multiple ecosystems daily. JavaScript wants camelCase, Python wants snake_case, CSS wants kebab-case, environment variables want SCREAMING_SNAKE. Refactoring a feature across all those layers means converting hundreds of identifiers. This converter automates the splitting + rejoining step so you can paste any input format and get any output format.
The 10 case conventions you'll actually meet
| Name | Example | Used by |
|---|---|---|
| camelCase | userProfilePicture | JavaScript, Java, C# methods/fields, Swift |
| PascalCase (UpperCamelCase) | UserProfilePicture | Class names in JS/Java/C#/Python; type names; .NET conventions |
| snake_case | user_profile_picture | Python, Ruby, Rust, PHP variables, SQL identifiers, file names |
| SCREAMING_SNAKE_CASE (UPPER_SNAKE) | USER_PROFILE_PICTURE | Constants, environment variables, enum values |
| kebab-case (dash-case) | user-profile-picture | CSS classes, URLs/slugs, HTML attributes, command-line flags |
| Title Case | User Profile Picture | Headings, button labels, marketing copy |
| Sentence case | User profile picture | Descriptions, paragraph copy, modern UI labels (Apple HIG, Material 3) |
| dot.case | user.profile.picture | i18n message keys, Java property files, configuration paths |
| path/case | user/profile/picture | File paths, URL paths, namespace separators |
| flatcase | userprofilepicture | Old DNS/legacy systems; rare in modern code |
Which case for which language? — Style guide reference
Each ecosystem has authoritative style guides. Following them isn't optional — linters enforce them automatically in 2026.
| Language | Variables / functions | Classes / types | Constants | Authoritative source |
|---|---|---|---|---|
| JavaScript / TypeScript | camelCase | PascalCase | SCREAMING_SNAKE | Airbnb, Google JS Style |
| Python | snake_case | PascalCase | SCREAMING_SNAKE | PEP 8 |
| Ruby | snake_case | PascalCase | SCREAMING_SNAKE | Rubocop / Ruby style guide |
| Rust | snake_case | PascalCase | SCREAMING_SNAKE | Rust style guidelines |
| Java | camelCase | PascalCase | SCREAMING_SNAKE | Oracle, Google Java Style |
| C# / .NET | camelCase (private), PascalCase (public) | PascalCase | PascalCase (.NET runtime), SCREAMING_SNAKE (older) | Microsoft .NET conventions |
| Go | camelCase (private), PascalCase (exported) | PascalCase | PascalCase or camelCase | gofmt + Effective Go |
| PHP | camelCase (PSR-12) | PascalCase | SCREAMING_SNAKE | PSR-12 |
| Swift | camelCase | PascalCase | camelCase (modern), SCREAMING_SNAKE (legacy) | Apple Swift API Design Guidelines |
| SQL | snake_case (PostgreSQL convention) | snake_case | SCREAMING_SNAKE | SQL style guide (no official) |
| HTML / CSS | kebab-case | kebab-case | kebab-case | W3C, BEM (CSS naming) |
| URLs / slugs | kebab-case | kebab-case | kebab-case | Google URL structure guidelines |
| Env vars / shell | SCREAMING_SNAKE | — | SCREAMING_SNAKE | POSIX |
How smart word splitting works
The hard part of case conversion isn't joining words — it's finding the words inside an existing identifier. This converter uses a multi-pass tokenizer:
Input: "userProfileXMLParser-v2"
Step 1: Split on non-alphanumeric (-, _, ., /, space)
→ ["userProfileXMLParser", "v2"]
Step 2: Split camelCase boundaries (lower → Upper transition)
→ ["user", "Profile", "XMLParser", "v2"]
Step 3: Split runs of UPPER followed by lowercase (acronym + word)
→ ["user", "Profile", "XML", "Parser", "v2"]
Step 4: Split letter-digit transitions (optional)
→ ["user", "Profile", "XML", "Parser", "v", "2"]
Step 5: Lowercase all
→ ["user", "profile", "xml", "parser", "v", "2"]
Step 6: Rejoin per target format
camelCase → "userProfileXmlParserV2"
snake_case → "user_profile_xml_parser_v_2"
kebab-case → "user-profile-xml-parser-v-2"
SCREAMING_SNAKE → "USER_PROFILE_XML_PARSER_V_2"
The tricky cases:
- Acronyms —
XMLParsershould split intoXML+Parser, notX+M+L+Parser. Look for runs of uppercase followed by a lowercase letter. - Abbreviated identifiers —
userIDscan be ambiguous:user+I+Ds?user+IDs? Most converters pick the latter, but it depends on heuristics. - Numbers — should
user2profilesplit intouser2+profileoruser+2+profile? Ask the converter what your style guide expects. - Multiple separators —
my_var-name.fieldneeds all three separators handled in one pass.
Case conversion in 8 programming languages
JavaScript / TypeScript (lodash, change-case)
// lodash (most popular)
import { camelCase, snakeCase, kebabCase, startCase } from 'lodash';
camelCase('user_profile_picture'); // 'userProfilePicture'
snakeCase('userProfilePicture'); // 'user_profile_picture'
kebabCase('UserProfilePicture'); // 'user-profile-picture'
// change-case (more granular control)
import { pascalCase, dotCase, pathCase } from 'change-case';
pascalCase('user-profile'); // 'UserProfile'
dotCase('userProfile'); // 'user.profile'
Python (built-in / inflection / stringcase)
import re
def camel_to_snake(name: str) -> str:
s = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s).lower()
camel_to_snake('userProfileXMLParser') # 'user_profile_xml_parser'
# Or use 'inflection' lib
import inflection
inflection.underscore('UserProfile') # 'user_profile'
inflection.camelize('user_profile') # 'UserProfile'
inflection.dasherize('user_profile') # 'user-profile'
Ruby (built-in)
# ActiveSupport (Rails)
"user_profile".camelize # "UserProfile"
"UserProfile".underscore # "user_profile"
"UserProfile".dasherize # "user-profile"
"user_profile".titleize # "User Profile"
# Plain Ruby
'user_profile'.split('_').map(&:capitalize).join # 'UserProfile'
Go (strings + custom)
import (
"strings"
"unicode"
)
func ToSnake(s string) string {
var out strings.Builder
for i, r := range s {
if unicode.IsUpper(r) && i > 0 {
out.WriteRune('_')
}
out.WriteRune(unicode.ToLower(r))
}
return out.String()
}
ToSnake("UserProfile") // "user_profile"
// Or use github.com/iancoleman/strcase for full coverage
Rust (heck crate)
use heck::{ToSnakeCase, ToKebabCase, ToPascalCase, ToShoutySnakeCase};
"UserProfile".to_snake_case(); // "user_profile"
"user_profile".to_pascal_case(); // "UserProfile"
"UserProfile".to_kebab_case(); // "user-profile"
"user_profile".to_shouty_snake_case(); // "USER_PROFILE"
PHP (str_*** functions / Symfony)
// Symfony String component
use Symfony\Component\String\u;
u('user_profile')->camel()->toString(); // 'userProfile'
u('userProfile')->snake()->toString(); // 'user_profile'
u('user_profile')->title()->toString(); // 'User_Profile'
// Laravel's Str helper
Str::camel('user_profile'); // 'userProfile'
Str::snake('UserProfile'); // 'user_profile'
Str::kebab('UserProfile'); // 'user-profile'
Java (Apache Commons + Guava)
import com.google.common.base.CaseFormat;
CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "user_profile");
// → "userProfile"
CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, "UserProfile");
// → "user-profile"
// Or Apache Commons WordUtils for title case
import org.apache.commons.text.WordUtils;
WordUtils.capitalize("user profile"); // "User Profile"
Bash / shell
# snake_case → kebab-case
echo "user_profile" | tr '_' '-'
# Lowercase / uppercase
echo "User Profile" | tr '[:upper:]' '[:lower:]' # "user profile"
echo "user_profile" | tr '[:lower:]' '[:upper:]' # "USER_PROFILE"
# camelCase → snake_case (sed)
echo "userProfileXMLParser" | sed -E 's/([A-Z]+)/_\1/g; s/^_//' | tr '[:upper:]' '[:lower:]'
# 'user_profile_x_m_l_parser' (naive — won't handle acronyms)
Common case conversion mistakes
- Mixing conventions in one file. A JS file with both
userProfileanduser_profilemeans refactor inconsistency. Run a linter (ESLint, Prettier) that enforces the convention. - Ignoring acronym rules. Microsoft's .NET style: acronyms ≤ 2 chars stay uppercase (
IO); ≥ 3 chars use camelCase (Xml, notXML). Different ecosystems disagree — pick a rule per project. - Naïve case conversion losing acronyms.
HTTPServer→ naïve snake_case →h_t_t_p_server. Smart converters preserve acronyms:http_server. - Inconsistent file vs identifier naming.
user_profile.jsexportingUserProfileworks but is confusing. Most ecosystems pick file naming based on the export type (PascalCase for class files in React/.NET, snake_case for module files in Python/Rust). - Reserved words after conversion.
class_name→classNameis fine, butmy_class→myClassand back tomy_classmay collide with reserved words in some destinations. - i18n key drift. Translation keys like
user.profile.titleshouldn't change case casually — every translation file references them. - URL slugs in mixed case.
/MyProfilevs/myprofileare different URLs to most servers. Use kebab-case (/my-profile) and lowercase consistently. - Conversion losing visible whitespace. "User profile picture" (sentence) and "user profile picture" (lowercase) are different — converting between them changes meaning in titles vs body.
Best case converter for 2026 — what to compare
Search results for "case converter online", "camelcase to snake_case", and "string case converter" return many tools but most fail on real-world identifiers: they don't handle acronyms (`XMLHttpRequest` should split as `xml http request`, not `xmlhttp request`), they break on already-cased input, or they don't surface all 6+ common cases simultaneously. Here is how the most-used case converters compare in 2026:
| Tool | Acronym handling | Cases supported | Browser-only | Cost |
|---|---|---|---|---|
| FreeDevTool Case Converter | Smart split (XMLHttpRequest → xml http request) | camel, Pascal, snake, kebab, UPPER_SNAKE, Title, dot, path | Yes | Free |
| convertcase.net | Limited | UPPER, lower, Title, Sentence | Yes | Free, ad-funded |
| caseconverter.com | Limited | UPPER, lower, Title, Sentence, alternating | Yes | Free, ad-heavy |
npm change-case | Full (configurable) | All 10+ | Local install | Free, OSS |
npm lodash (camelCase, snakeCase) | Good | camel, snake, kebab, start, upper | Local install | Free, OSS |
| VS Code Multi-edit + extensions | Manual | All via "Change Case" extension | Local IDE | Free |
How do I convert camelCase to snake_case online?
Paste your camelCase identifier into the input field. The smart word splitter detects the case boundary on every uppercase letter — userName becomes user name internally, then re-joins as user_name for the snake_case output. The same operation happens automatically for all six other cases (kebab-case → user-name, PascalCase → UserName, UPPER_SNAKE → USER_NAME, Title Case → User Name, dot.case → user.name). Edge cases handled: consecutive capitals like HTTPSConnection split correctly as https connection (not h t t p s connection), digits stay attached to their preceding word (htmlParserV2 → html parser v2), and pre-existing separators (spaces, hyphens, underscores, dots) all serve as word boundaries.
What's the difference between camelCase, PascalCase, snake_case, and kebab-case?
Five conventions that all encode the same words differently — pick by language, by context, or by team style guide:
| Case | Example | Used in |
|---|---|---|
| camelCase | userName | JavaScript / TypeScript variables, Java methods, Swift |
| PascalCase | UserName | Class names (most languages), C# methods, React components |
| snake_case | user_name | Python, Ruby, Rust, database column names |
| kebab-case | user-name | URLs, CSS classes, HTML attributes, npm packages |
| UPPER_SNAKE | USER_NAME | Constants in most languages, environment variables |
| Title Case | User Name | Headings, proper-noun rendering |
| dot.case | user.name | Some config systems, Java property files |
Decision rule: variable name → camelCase (JS) or snake_case (Python). Class name → PascalCase. URL slug → kebab-case (use the URL Slug Generator for SEO-friendly slugs). Constant → UPPER_SNAKE. Don't mix conventions within a single language; ESLint/Pylint enforce the language norm automatically.
Case converter alternative to convertcase.net — 4 reasons developers switched
- Programming-aware, not just text-aware. convertcase.net handles UPPERCASE / lowercase / Title / aLtErNaTiNg cases — useful for prose, useless for code. This tool handles every programming naming convention out of the box.
- Smart acronym splitting.
XMLHttpRequest→xml http request(correct) instead ofxmlhttp request(wrong). Critical for refactoring legacy Java/C# codebases with classic acronym-heavy class names. - All cases visible simultaneously. Paste once, see all 7 outputs side-by-side. Most tools force you to pick one target case per click — slows down "what should this snake_case become?" exploration.
- No ads, no popups. Tools indexed for "case converter" almost universally inject ads. This page is browser-only, ad-free, persists nothing.
Pair the case converter with the URL Slug Generator for SEO-friendly kebab slugs, the String Escape Tool for character-level transformations, the Regex Tester for pattern-based renames, and the Code & Text Tools hub for the broader text manipulation toolkit.
Case convention best practices
- Follow your ecosystem's conventions. PEP 8 for Python, Airbnb/Standard for JS, Effective Go for Go. Rebellions cost code-review time forever.
- Run a linter that enforces casing. ESLint
id-match, Pylintinvalid-name, Rubocop, gofmt — automatic enforcement > manual. - Keep file names and identifiers aligned. A
UserProfileclass lives inUserProfile.tsx(React) oruser_profile.py(Python). Mixing breaks IDE shortcuts. - Use SCREAMING_SNAKE only for true constants and env vars. Module-level
readonlyvalues that are computed at runtime aren't constants — use camelCase or PascalCase. - Pick kebab-case for everything URL-ish. Slugs, CSS classes, HTML attributes, custom elements (
<my-button>). Hyphens are URL-friendly and Google-friendly. - Avoid Hungarian notation in 2026. Prefixing with type (
strName,iCount) is dated and adds noise. Type systems handle this now. - Title Case for headings, Sentence case for everything else. Most modern UIs (Apple, Material 3, Microsoft Fluent) recommend Sentence case for buttons and labels — feels less shouty.
- For database columns, use snake_case. SQL identifiers fold to lowercase in PostgreSQL by default; quoting with
"camelCase"is portability hell.