camelCase to snake_case
Convert camelCase to snake_case in your browser: userId becomes user_id. 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
camelCase to snake_case examples
| camelCase | snake_case | Copy |
|---|---|---|
| userId | user_id | |
| createdAt | created_at | |
| getUserByID | get_user_by_id | |
| parseHTTPResponse2 | parse_http_response2 | |
| isOAuth2Enabled | is_o_auth2_enabled | |
| base64Encode | base64_encode |
2 rows do not survive the round trip back to camelCase: get_user_by_id comes back as getUserById, not getUserByID; parse_http_response2 comes back as parseHttpResponse2, not parseHTTPResponse2. 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 camelCase to snake_case
The usual trip is a JavaScript object or a JSON payload landing in Python or SQL: a createdAt field becomes a created_at column, which is what PEP 8 and most database style guides expect. Serializers can rename every key on the way in — Pydantic’s alias generators, for one — but a migration script, a column list or a single field renamed in review is still a one-off, and that is what this page is for.
How the conversion works
The converter first reads getUserByID as the words get / user / by / id — 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 joins the lowercase words with underscores: get_user_by_id. Since it starts from the words and not from the camelCase spelling, text already in any other case gives the same result.
Other conversions
Going the other way? snake_case to camelCase.
- 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.