snake_case to camelCase
Convert snake_case to camelCase in your browser: user_id becomes userId. With 6 examples, acronyms and digits included — 2 of them do not convert back unchanged, and the page shows why. Free, nothing uploaded.
Part of writing tools and developer tools.
camelCase
userId
PascalCase
UserId
snake_case
user_id
SCREAMING_SNAKE_CASE
USER_ID
kebab-case
user-id
Title Case
User Id
Sentence case
User id
lower case
user id
UPPER CASE
USER ID
snake_case to camelCase examples
| snake_case | camelCase | Copy |
|---|---|---|
| user_id | userId | |
| created_at | createdAt | |
| first_name | firstName | |
| is_active | isActive | |
| address_line_2 | addressLine2 | |
| http_status_code_404 | httpStatusCode404 |
2 rows do not survive the round trip back to snake_case: addressLine2 comes back as address_line2, not address_line_2; httpStatusCode404 comes back as http_status_code404, not http_status_code_404. The converter keeps only the words, lowercased, so the capitals of an acronym and the place of a separator before a digit are gone once the text is converted.
Where you convert snake_case to camelCase
The reverse trip: an API written in Python, Ruby or straight over SQL answers with user_id and created_at, and the JavaScript front end wants userId and createdAt so its code does not mix two conventions. fetch and axios hand the keys over untouched, so the rename happens either in a helper that walks the whole object or, for a handful of fields, by hand — which is where it goes wrong on the fields with numbers in them.
How the conversion works
The converter first reads address_line_2 as the words address / line / 2 — splitting on spaces, underscores and hyphens, before every capital that follows a lowercase letter or a digit, and before the last capital of a run that starts a new word (HTTPResponse is HTTP / Response). Then it keeps the first word lowercase, capitalises the first letter of every following word and joins them with no separator: addressLine2. Since it starts from the words and not from the snake_case spelling, text already in any other case gives the same result.
Other conversions
Going the other way? camelCase to snake_case.
- kebab-case to camelCase
- camelCase to kebab-case
- PascalCase to snake_case
- snake_case to PascalCase
- camelCase to SCREAMING_SNAKE_CASE
- Sentence case to camelCase
Or open the full case converter and see your text in all nine cases at once.