devkult_
tools26converters34
home/convert/camel-to-snake

Convert camelCase to snake_case

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 · camelCasesnake_case
camelCase input
userName
createdAt
HTTPServerError
isActive
snake_case output
user_name
created_at
http_server_error
is_active

Try it with your own data

Loading tool…

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.

Frequently asked questions

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.

How does the converter know where words start and end?

It splits on separators (underscores, hyphens, spaces) and on lowercase-to-uppercase boundaries, keeping acronym runs together — so HTTPServerError splits into HTTP, Server, Error regardless of the input convention.

Can I convert many identifiers at once?

Yes — put one identifier or phrase per line and every output format converts the whole list, ready to copy as a block.

Related converters