Case Converter (camelCase, PascalCase, snake_case, kebab-case)

Convert text between common code naming conventions. Word boundaries are detected from spaces, underscores, hyphens, and capitalization, including acronyms. Everything runs in your browser.

The five conventions

ConventionExampleTypically used for
camelCaseuserAccountIdVariables and methods in Java, JavaScript, C++
PascalCaseUserAccountIdClasses and types nearly everywhere, plus C# members
snake_caseuser_account_idPython, Ruby, Rust, SQL columns
kebab-caseuser-account-idURLs, CSS classes, HTML attributes, CLI flags
CONSTANT_CASEUSER_ACCOUNT_IDConstants and environment variables

The differences are conventional rather than technical. What matters is consistency within a codebase, since mixed conventions make identifiers harder to predict and search for.

How word boundaries are detected

The hard part of case conversion is deciding where one word ends and the next begins. This tool splits on:

The acronym rule is what naive implementations get wrong. Splitting on every uppercase letter turns XMLHttpRequest into x_m_l_http_request instead of the correct xml_http_request. The rule is that a run of capitals belongs together, except that the last capital starts a new word if a lowercase letter follows it.

Accented letters such as é, ö, and ü are preserved rather than stripped, which matters for identifiers derived from non-English text.

Examples

InputcamelCasePascalCasesnake_casekebab-case
hello worldhelloWorldHelloWorldhello_worldhello-world
XMLHttpRequestxmlHttpRequestXmlHttpRequestxml_http_requestxml-http-request
user_iduserIdUserIduser_iduser-id
parse-JSON-fileparseJsonFileParseJsonFileparse_json_fileparse-json-file
user2Nameuser2NameUser2Nameuser2_nameuser2-name

Where each convention belongs

URLs and CSS use kebab-case

URLs are case-insensitive in the host portion and conventionally lowercase throughout, so word separation needs a visible character. Underscores are poorly suited because they can be hidden by link underlining, which is one reason hyphens became standard. Search engines also treat hyphens as word separators and underscores as joiners, so blue-widgets reads as two words while blue_widgets may read as one.

SQL prefers snake_case

SQL identifiers are case-insensitive in most databases unless quoted, so userName and username are the same column. Since capitalization cannot be relied upon to separate words, underscores are the practical choice.

C# capitalizes public members

.NET convention uses PascalCase for classes, methods, and public properties, and camelCase for local variables and parameters. This differs from Java, where methods are camelCase, and is a common source of friction when porting code or consuming JSON APIs. See the JSON to C# tool for handling that mapping.

Environment variables use CONSTANT_CASE

Uppercase with underscores is near-universal for environment variables, partly by Unix convention and partly because shells treat variable names case-sensitively, so a consistent style avoids collisions with lowercase shell functions.

Frequently asked questions

What happens with numbers?

Digits attach to the preceding word, so user2Name yields the words user2 and Name. Splitting before digits would break identifiers like base64Encode.

What about symbols or emoji in the input?

Only letters and digits form words. Everything else acts as a separator and is dropped from the output, since no naming convention permits punctuation in identifiers.

How are acronyms handled?

XMLParser becomes XML plus Parser, producing xml_parser rather than x_m_l_parser. Note that PascalCase output normalizes acronyms to XmlParser, which matches .NET conventions.

Is Title Case supported?

Not currently. The tool targets code identifier conventions rather than prose capitalization, which involves language-specific rules about which words to capitalize.

Why does kebab-case not work for variable names?

Because a hyphen is the subtraction operator in most languages, so user-name would parse as user minus name. It is used only where the text is not parsed as code, such as URLs, CSS, and CLI flags.

Is my input sent anywhere?

No. Conversion happens entirely in your browser.

Related tools