Convert text to camelCase

Type user_account_id, user-account-id or “user account id” to get userAccountId, live as you type. camelCase is the convention for variables and keys in JavaScript, TypeScript, Java and Swift. Acronyms need an explicit separator (“api key” → apiKey). The other four conventions are shown alongside. Conversion stays in this tab.

camelCase

userAccountId

PascalCase

UserAccountId

snake_case

user_account_id

kebab-case

user-account-id

CONSTANT_CASE

USER_ACCOUNT_ID

Converted as you typeNothing leaves this tab

Runs in this tab · nothing is uploaded · Verify in 10 seconds →

What this does

camelCase removes the separators between words and capitalizes each word after the first: user_account_id, user-account-id and “user account id” all become userAccountId. Type below and read the camelCase row, conversion is live, with the other four conventions shown alongside.

camelCase is the only common convention that spends zero characters on separation: across the 244 unique object keys harvested from our 26-document sample corpus (measured by scripts/preset-stats.mjs with the same conversion functions this page runs), the average key is 7.2 characters in camelCase versus 7.5 in snake_case and kebab-case, 67 of the 244 keys are multi-word and pay one separator character per word boundary in those conventions.

Where camelCase is the convention

camelCase is the default for values in the languages that grew up on Java and JavaScript. Types, and only types, take the capital first letter (PascalCase). Constants often leave camelCase entirely and sit in SCREAMING_SNAKE, which is the CONSTANT_CASE row on this page.

  • JavaScript and TypeScript. Variables, functions, methods, parameters and object keys: getUserById, accountId, onClick, useMemo. React and Vue components, classes, and TypeScript types or interfaces are PascalCase: UserAccount, <UserCard />, type InvoiceLine. File names are mixed (user-card.tsx next to getUserById.ts); this converter does not rename files.
  • Java, Kotlin and C#. Java and Kotlin use camelCase members (invoiceTotal, findById) and PascalCase types (InvoiceService). C# and .NET public methods and properties are PascalCase (FindById, InvoiceTotal); locals and parameters stay camelCase. Kotlin data-class properties that serialize to JSON are camelCase unless an annotation says otherwise.
  • Swift. Properties, methods and enum cases are camelCase (userID is the house style for a trailing acronym). Types and protocols are PascalCase (URLSession, Hashable).
  • JSON and GraphQL. Node and GraphQL payloads usually spell keys in camelCase (userAccountId). A Rails, Django, Laravel or FastAPI payload is often snake_case (user_account_id). Convert at that boundary rather than mixing both spellings in one document.
  • Not camelCase. CSS class names, custom properties, HTML attributes, URL slugs and GNU-style CLI flags are kebab-case. Python (PEP 8), Ruby, Rust and SQL identifiers are snake_case. Go uses PascalCase for exported names and camelCase for unexported ones, never underscores.

What the camelCase row actually does

The implementation is two substitutions. First, every run of -, _ or whitespace plus the character that follows is replaced by that character in uppercase (or dropped if nothing follows). Second, only the first character of the whole string is forced lowercase. The insides of each word are left as you typed them. That is why already-lowercased input (user_account_id, “user account id”, user-account-id) produces the conventional userAccountId, while ALL_CAPS input does not.

There is no acronym dictionary and no split on camelCase humps when the output is already camelCase: UserAccountId becomes userAccountId (first letter only), and HTTPRequest becomes hTTPRequest. parseJSON stays parseJSON. A digit does not create a capital: user2fa stays user2fa; utf8String stays utf8String.

Unicode letters pass through JavaScript’s own case mapping, they are not stripped: café_menu becomes caféMenu, 日本語_label becomes 日本語Label. Dots, slashes and other punctuation are not separators, so user.accountId stays user.accountId. Consecutive separators collapse (user__account and user--account both become userAccount). Leading and trailing separators are discarded (_user and user_ both become user). For a public URL that must also drop accents and symbols, use the Slug Generator, not this row.

A practical rename: a Django or Rails field billing_address_line_1 becomes billingAddressLine1, which is what a TypeScript interface property, a Zustand store key and a React state field all want. The matching type name BillingAddressLine1 sits on the PascalCase row. The DOM already does this hop for data attributes: data-user-id is exposed as element.dataset.userId. localStorage keys and IndexedDB object-store names have no required convention; pick one spelling and convert at the boundary. ESLint’s camelcase rule and most Prettier setups assume this spelling for identifiers; they will not rewrite a string for you.

Worth typing: get_object_or_404 becomes getObjectOr404, created_at becomes createdAt, “max retries” becomes maxRetries, X-Request-Id becomes xRequestId. onSubmit and useEffect are already camelCase and only change if you alter the first letter. HTTPRequest and APIKey stay glued after that first letter drops.

When it goes wrong

This row is not a linguist. It deletes runs of hyphens, underscores and whitespace, uppercases the character after each run, then lowercases only the first character of the result. It does not lowercase the rest of each word, so HTTP_REQUEST becomes hTTPREQUEST and “API key” becomes aPIKey. Feed already-lowercased words (http_request, api key) when you want httpRequest and apiKey. All-caps runs without a separator stay glued: HTTPRequest becomes hTTPRequest, not httpRequest. Digits stick to the word they sit in: user2fa stays user2fa.

When to use this

Reach for camelCase when the destination is a JavaScript or TypeScript identifier, a JSON key for a browser client, or a Java, Kotlin or Swift member. C# public methods and properties want the PascalCase row. Use the snake_case row when the same field has to land in Python, Ruby, Rust or SQL.

This page is a focused view of theCase Converter, which has the full set of options.

Frequently asked questions

What's the difference between camelCase and PascalCase?

Only the first letter: camelCase starts lowercase (userAccountId), PascalCase starts uppercase (UserAccountId). PascalCase conventionally marks types, classes and UI components; camelCase marks values. The tool shows both rows.

How are acronyms handled?

There is no acronym list. Lowercased words with a separator become conventional camelCase: “api key” and api_key become apiKey. Already-capital input does not get rewritten word-by-word, so “API key” becomes aPIKey and HTTPRequest becomes hTTPRequest. Type the words in lowercase when you want a clean result.

How do I convert snake_case JSON keys to JavaScript properties?

Paste the key. user_account_id, user-account-id and “user account id” all become userAccountId on the camelCase row. The PascalCase row is the matching type name (UserAccountId) if you are declaring an interface next to the value.

Why did HTTP_REQUEST become hTTPREQUEST?

Only the first character of the result is lowercased. The rest of each word stays as typed, so an ALL_CAPS token with separators becomes a single lumpy identifier. Paste http_request or “http request” to get httpRequest.

Can I use camelCase for CSS classes or URLs?

You can, but you should not. CSS classes, custom properties, HTML attributes and URL slugs use kebab-case so word boundaries survive case-insensitive contexts. Open the kebab-case preset for that row.