# Snake to Camel Case Converter

> Convert snake_case identifiers to camelCase in one step: underscores become word breaks, the first word stays lowercase, later words are capitalised.

Source: https://devplain.com/snake-to-camel-case-converter/
Last updated: 2026-10-30

Convert snake_case identifiers to camelCase in one step: underscores become word breaks, the first word stays lowercase, later words are capitalised.

## How It Works

Converting snake_case to camelCase is a two-step rewrite: split the identifier at its separators, then join the pieces with the first letter of each later piece upper-cased. This page opens the case converter already in camelCase mode, so a single database or Python identifier becomes a JavaScript name without a round trip through find-and-replace. The whole pasted string is converted as one value — there is no per-line mode, and that limitation is spelled out below.

**How the split works.** The text is divided on runs of whitespace, underscores and hyphens, so user_first_name, user first name and user-first-name are treated identically. Repeated separators collapse: hello__world has an empty piece between the underscores, the empty piece is dropped, and the result is helloWorld rather than a double capital.

**How the join works.** The first piece keeps its first character lower-cased and the rest of its letters as they are; every later piece gets its first character upper-cased and the rest unchanged. That produces user_first_name → userFirstName and hello_world_2 → helloWorld2, because digits count as ordinary characters inside a piece rather than as separators.

**Line breaks are separators, not rows.** A newline belongs to the same whitespace class as a space, so pasting two identifiers on two lines does not convert them separately. The pieces are gathered across the whole input and joined with no separator at all: user_name followed by a line break and order_id becomes userNameOrderId, one name rather than two. The tool has no per-line mode, so for a column of identifiers convert them one at a time and paste each result back, or run the conversion in your editor with a script.

**What it does to capitals you already have.** The converter only touches the first letter of a piece, so an acronym that arrives in capitals stays in capitals and lands awkwardly: HTTP_server becomes hTTPServer, not httpServer. If your identifiers contain acronyms, convert them separately or fix them by hand afterwards. Text that is already camelCase passes through unchanged, because the whole string is one piece and its first character is already lower-case.

**What is preserved.** Characters outside ASCII are not re-cased, so a mixed identifier such as 订单_id becomes 订单Id — the Chinese characters keep their form while the Latin piece is capitalised. Nothing is validated as an identifier: a result starting with a digit or containing a reserved word is returned exactly as computed, and the tool does not check whether the name is legal JavaScript.

### How to convert a snake_case identifier

1. Paste one identifier at a time. Line breaks count as separators, so several lines are merged into a single camelCase name.
2. Confirm the mode selector reads camelCase; the same tool can also produce snake_case and other styles.
3. Scan the result for acronyms, which keep their capitals and often need a manual fix.
4. Copy the output back into your source file and run your linter to confirm the name is legal.

### Input and output side by side

| snake_case input | camelCase output | Rule at work |
| --- | --- | --- |
| hello_world | helloWorld | One separator, second piece capitalised |
| user_first_name | userFirstName | Every separator starts a new capitalised piece |
| hello__world | helloWorld | The empty piece from a double underscore is dropped |
| HTTP_server | hTTPServer | Only the first letter of a piece is re-cased |

## Examples

### Input

```
user_first_name
```

### Output

```
userFirstName
```

The standard case: each underscore starts a capitalised piece.

### Input

```
hello__world
```

### Output

```
helloWorld
```

Boundary case: a doubled underscore produces an empty piece, which is dropped instead of creating a double capital.

### Input

```
HTTP_server
```

### Output

```
hTTPServer
```

Boundary case: an acronym keeps its internal capitals, which is why this one usually needs a manual rename.

### Input

```
helloWorld
```

### Output

```
helloWorld
```

Already camelCase input passes through unchanged.

## Frequently Asked Questions

**Does it handle more than one underscore?**

Yes. Separators are matched as runs, and empty pieces are dropped, so hello__world and hello___world both become helloWorld. The same holds for mixed separators: hello _ world and hello-world give the same result, which is useful when a column arrives with inconsistent separators.

**Why did HTTP_server become hTTPServer?**

Because the converter lower-cases only the very first character of the first piece and leaves the rest untouched, so the capitals inside HTTP survive. That keeps existing capitalisation intact but produces an odd acronym. Rename it by hand to httpServer, or convert the acronym separately before running the rest of the list.

**Is this the same as converting back to snake_case?**

No, that is the reverse direction. The mode selector on the same tool offers snake_case and SCREAMING_SNAKE_CASE, which split on the same separators and join with underscores. One caveat: camelCase input has no separators, so converting camelCase back to snake_case cannot recover the original word boundaries.

**Can it convert a whole file at once?**

No. The converter rewrites the entire pasted string as one value, and a newline is just another separator, so a list of identifiers collapses into a single camelCase name. Convert one identifier per paste, or run a script over the file in your editor. The conversion runs locally, so nothing you paste leaves the browser.

## Limitations & Accuracy

Only the first letter of each piece is changed, so acronyms keep their capitals and HTTP_server becomes hTTPServer. Characters outside ASCII are never re-cased, and the result is not validated as an identifier: names that start with a digit or collide with reserved words are returned anyway. Line breaks are ordinary separators, so a multi-line paste is merged into one camelCase string rather than converted row by row. Converting camelCase back to snake_case cannot recover word boundaries that camelCase never marked.

## Related Tools

- [Case Converter](https://devplain.com/case-converter/)
- [Title Case Converter](https://devplain.com/title-case-converter/)
- [All tools](https://devplain.com/tools/)

Last updated: 2026-10-30

