Case Converter
Convert text between camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, Title Case, Sentence case, and dot.case. Works on any input — your text never leaves your browser.
How it works
- 1Paste textSingle line or multi-line.
- 2Pick outputConvert button per case style.
- 3CopyClick copy on any output.
Naming conventions across languages: which case, when, and why
Why naming conventions exist
Code is read more often than it's written. A consistent naming convention makes scanning faster: you don't need to parse `userIdHere` to know it's three words because the case transitions tell you. Mixed conventions slow readers and create bugs (people typing the wrong variant).
Every major language has a dominant convention encoded in its standard library and style guide. Following it isn't aesthetic — it's communication. A Python file with `getUserName` instead of `get_user_name` reads as foreign code by a Python developer; a JavaScript file with `get_user_name` looks suspicious to JS developers.
The four core conventions
**camelCase** — first word lowercase, subsequent words capitalized: `getUserName`. Dominant in JavaScript, Java, C#, Swift, Kotlin variables and methods. Origin: invented for early Smalltalk; the 'camel' is the visual hump of capital letters in the middle.
**PascalCase** (UpperCamelCase) — every word capitalized, no separators: `GetUserName`. Used for classes, types, and constants in most languages. Named after Pascal where it was the only convention.
**snake_case** — lowercase words joined by underscores: `get_user_name`. Standard in Python, Ruby, Rust, Perl, C++ stdlib, SQL column names. Easier to read for long compound words; harder to type quickly.
**kebab-case** — lowercase words joined by hyphens: `get-user-name`. Used in CSS class names, HTML attributes, URL slugs, Lisp, file names. Cannot be used as a programming-language identifier (the hyphen is subtraction in most languages).
The less common cases
**CONSTANT_CASE** (SCREAMING_SNAKE_CASE) — uppercase with underscores: `MAX_RETRIES`. Conventional for compile-time constants and environment variables. Visually distinguishes 'this never changes' from 'this might change.'
**dot.case** — words joined by dots: `user.name`. Used in property paths (i18n keys, JSON Pointer, settings keys, npm package paths). Rare as a primary naming convention; common as a separator in nested structures.
**Title Case** — every word capitalized including separators: `Get User Name`. Display-only — headings, button labels, product names. Style guides disagree on whether short words (a, the, of) are capitalized. Sentence case ('Get user name') is the modern web convention; Title Case ('Get User Name') is more formal.
How to tokenize correctly
Converting between cases requires splitting the input into tokens (words). Splitting rules: whitespace and punctuation are separators; case transitions inside a word are word boundaries (`fooBar` → `foo, Bar`); runs of capitals followed by a lowercase letter mark an acronym + next word (`XMLHttp` → `XML, Http`); digits are usually attached to the preceding word.
Edge cases that bite: numbers in the middle (`mp3Player` → ['mp', '3', 'Player'] or ['mp3', 'Player']?), trailing acronyms (`parseURL`), and mixed scripts. A practical converter accepts that some inputs will round-trip imperfectly and lets users tweak the result manually.
Tooling and IDE support
Most IDEs have built-in case conversion on selected text (VS Code: 'Transform to ...' commands; JetBrains: 'Capitalize'). For bulk renames across a codebase, use language-aware refactoring tools (`tsserver` for TypeScript, Rust's `rust-analyzer`, etc.) — they understand semantics, not just text.
When you must do a project-wide case rename without a refactoring tool, do it in a branch, run the tests, and review the diff carefully. Naming changes often touch comments and string literals that you didn't intend to change.
Frequently asked
How does the converter tokenize my input?
It splits on whitespace, dashes, underscores, dots, and on transitions from lowercase to uppercase (so 'fooBar' becomes ['foo', 'Bar']). Non-letter, non-digit characters are dropped between tokens.
Which case is right for what?
JavaScript variables: camelCase. Class names: PascalCase. Python variables and Ruby: snake_case. CSS classes and URL slugs: kebab-case. Environment variables and SQL: CONSTANT_CASE. Display titles: Title Case. Most languages have a dominant convention — follow it.
Does it handle acronyms correctly?
Mostly. 'XMLHttpRequest' tokenizes to ['XML', 'Http', 'Request'] then case-converts. PascalCase preserves the acronym uppercase ('XMLHttpRequest'); camelCase lowercases the first ('xmlHttpRequest'). For perfect acronym handling, pre-edit your input.
Get new tools first.
One tool per week. No ads. Unsubscribe anytime.