# Convert camelCase to snake_case

> Convert camelCase identifiers to snake_case online. Free converter that handles acronyms and mixed input, with a live tool for bulk conversion.

Moving identifiers from JavaScript to Python, or from a JSON API into a database schema, usually means converting camelCase to snake_case. This converter splits each identifier at its capital-letter boundaries — including acronym runs like HTTPServer — and re-joins the words with underscores.

## Example: camelCase → snake_case

Input:
```
userName
createdAt
HTTPServerError
isActive
```

Output:
```
user_name
created_at
http_server_error
is_active
```

## How to convert camelCase to snake_case

1. Split the identifier at each lowercase-to-uppercase boundary (userName → user, Name).
2. Keep acronym runs together (HTTPServer → HTTP, Server).
3. Lowercase every word and join them with underscores.

## FAQ

### How are acronyms like HTTPError handled?

A run of capitals is treated as one word until the final capital that starts a new word: HTTPServerError becomes http_server_error, not h_t_t_p_server_error.

### Why do Python and databases prefer snake_case?

PEP 8 mandates snake_case for Python variables and functions, and most SQL conventions use it because identifiers are case-insensitive in many databases — underscores keep word boundaries readable.

## Related converters

- [snake_case → camelCase](https://www.devkult.com/convert/snake-to-camel.md)
- [camelCase → kebab-case](https://www.devkult.com/convert/camel-to-kebab.md)
- [snake_case → kebab-case](https://www.devkult.com/convert/snake-to-kebab.md)

Open the interactive converter: https://www.devkult.com/convert/camel-to-snake