Text case converter

Convert any text between the six naming conventions developers use daily — camelCase, PascalCase, snake_case, kebab-case, Title Case and UPPERCASE.

Text Case Converter

Convert any text between the six cases developers juggle daily — camelCase for JavaScript, kebab-case for CSS and URLs, snake_case for databases, and more.

Mixed input is fine — existing camelCase, hyphens, underscores and spaces are all understood and re-split into words first.

Converted

camelCase
PascalCase
snake_case
kebab-case
Title Case
UPPERCASE

Why Naming Conventions Differ Across the Stack

Each case convention exists because of its environment's rules. JavaScript uses camelCase because identifiers can't contain hyphens; CSS classes and URLs prefer kebab-case because they're case-insensitive contexts where hyphens read naturally (and Google treats hyphens as word separators — see the URL slug generator above); databases lean on snake_case because many SQL dialects fold unquoted identifiers to lowercase.

The convention that matters most is consistency within a codebase: mixed naming forces every developer to guess, and renaming later touches every reference. Pick per-layer conventions once, document them, and let a converter handle the boundaries between layers.

Why every layer of the stack uses a different case

The conventions aren't arbitrary — each one exists because of a constraint in its environment.

camelCase dominates JavaScript because identifiers can't contain hyphens (a hyphen is the minus operator) and the language's own APIs use it. PascalCase distinguishes things that get instantiated or rendered — classes, and components in React, where an uppercase first letter is what tells JSX to treat a tag as a component rather than an HTML element.

kebab-case owns CSS and URLs. Both are case-insensitive contexts where hyphens read naturally, and Google explicitly treats hyphens as word separators in URLs while underscores join words together. snake_case rules databases and Python, largely because many SQL dialects fold unquoted identifiers to lowercase, making camelCase unreliable across systems.

The conversion is harder than it looks

Converting between cases means first splitting text into words — and the input rarely announces its own format. This converter handles the common cases: it splits on spaces, hyphens and underscores, and it detects camelCase boundaries by looking for a lowercase character followed by an uppercase one.

The edge cases that break naive converters are worth knowing if you write your own. Consecutive capitals (XMLHttpRequest, parseJSON) are genuinely ambiguous — is JSON one word or four letters? Numbers create similar problems: should address2 become address-2 or address2? There is no universally correct answer, only a convention your codebase applies consistently.

Where conversion actually comes up

The most frequent real-world case is crossing a boundary between systems. An API returns snake_case JSON and your JavaScript wants camelCase. A design token named in kebab-case needs a camelCase equivalent in a theme object. A database column becomes a form field name.

For one-off work a converter is faster than fiddling with a regex. For anything systematic, do the conversion in one place — a single mapping layer where API responses enter your app — rather than scattering ad-hoc renames through your codebase.

Consistency beats correctness

There is no objectively best convention, and arguing about it is one of programming's great time sinks. What genuinely costs teams time is inconsistency: when developers have to guess whether a helper is getUserId, get_user_id or GetUserID, every lookup becomes a search.

Pick a convention per layer, follow the ecosystem's default where one exists, write it down, and enforce it with a linter so it stops being a discussion. If you need to rename existing code, do it as its own commit — mixing renames into a feature change makes the diff unreviewable.

Frequently asked questions

What is the difference between camelCase and PascalCase?

Both join words with capitals, but camelCase starts lowercase (getUserName) and PascalCase starts uppercase (GetUserName). JavaScript uses camelCase for variables and functions, and PascalCase for classes and React components.

Should URLs use hyphens or underscores?

Hyphens. Google treats a hyphen as a word separator, so css-tricks reads as two words, while css_tricks is read as one. Google has recommended hyphens in URLs for well over a decade.

Why do databases use snake_case?

Many SQL dialects fold unquoted identifiers to lowercase, which makes camelCase unreliable across systems — userName can silently become username. snake_case survives that folding intact, so word boundaries stay readable.

How does the converter handle acronyms like XMLHttpRequest?

It splits on the boundary between a lowercase and an uppercase character, so runs of consecutive capitals stay grouped. Acronyms are genuinely ambiguous in case conversion — check the result when your input contains them.