snake_case Converter

Convert camelCase, PascalCase, kebab-case or plain text to snake_case. Correctly splits acronyms like XMLHttpRequest and keeps digits. Each line separately.

Example: userAccountId → user_account_id

Output

Each line is converted separately. Words are split at spaces, punctuation, _ - . / and camelCase boundaries; acronyms such as XML stay together and digits stay attached to the previous word.

Related Tools

View All

What is snake_case?

This tool converts identifiers and phrases to snake_case: all lowercase words joined by underscores, the standard style for Python variables, Ruby methods and SQL column names.

How to use snake_case

  1. Type or paste text into the Input box – one identifier or phrase per line (or click Load sample).
  2. The converted text appears instantly in the Output box.
  3. Click Copy to copy the result.

Example

Input
XMLHttpRequest2Go
Hello World
Output
xml_http_request2_go
hello_world

When to use snake_case

Use it to turn JavaScript or Java names into Python/SQL style, or to create database column names. For environment variables or constants use CONSTANT_CASE instead.

How snake_case works

The input is split into words, every word is lower-cased and the words are joined with _. Words are split at spaces, punctuation and the separators _ - . /, and at case changes inside identifiers: fooBar → foo + Bar, and an acronym run is kept together (XMLHttpRequest → XML + Http + Request). Digits stay attached to the word before them (Request2Go → Request2 + Go), apostrophes inside words are dropped (don't → dont), and letters of any script (é, ñ, Cyrillic, Greek…) are supported. Every line is converted separately.

Common Use Cases

  • Converting JSON keys to Python variable names
  • Creating SQL column names from labels
  • Renaming camelCase fields when porting code to Python
  • Generating file names

Security Note

Everything runs locally in your browser; the code you paste is not uploaded.

FAQs

How is XMLHttpRequest split?

Into XML, Http and Request, giving xml_http_request.

Are accented letters removed?

No, they are kept (Ñandú grande → ñandú_grande). Use a slug generator if you need ASCII only.

What about existing underscores?

They are treated as separators, so runs of _ collapse to one.

Explore more categories