Skip to content

snake_case

Convert text to snake_case.

Input
Output

No result

About snake_case

snake_case converts text to the lowercase, underscore-joined naming style used for variables, file names and database columns. Give it a phrase or an identifier in almost any common style, and it returns the words split apart, lowercased and joined with underscores - so Hello World Example becomes hello_world_example.

The splitting is the part that makes it useful. camelCase boundaries are detected, and hyphens, underscores, dots and slashes all act as word separators, so HelloWorld, hello-world and hello_world all converge on the same output. Runs of whitespace collapse to a single underscore, which keeps the result clean even when the input is unevenly spaced.

The trade-off is that the transform is lossy. Because every separator flattens into the same underscore, the original form cannot be recovered - a space, a hyphen and a camelCase boundary all leave the identical trace. Digits are treated as part of a word rather than as boundaries, so Hello2World becomes hello2_world, which is worth knowing when the number marks a version or an index.

How to use snake_case

  1. 1 Type or paste the text or identifier you want in snake_case.
  2. 2 Read the result as it updates - words are lowercased and joined with underscores.
  3. 3 Copy the output; camelCase, hyphens, dots and slashes are all treated as word boundaries.

Frequently asked questions

How are the words split apart?

camelCase boundaries and hyphens, underscores, dots and slashes all act as separators, then the words are lowercased and joined with underscores. HelloWorld, hello-world and hello_world all become hello_world.

Why do different inputs give the same result?

Every separator flattens into the same underscore, so the original form is lost. A space, a hyphen and a camelCase boundary leave an identical trace, and there is no way to tell them apart in the output.

How are numbers handled?

Digits are treated as part of a word rather than as boundaries, so Hello2World becomes hello2_world. That can matter when a number marks a version or an index and you expected a split around it.

Can I keep uppercase or change the separator?

No. Everything is lowercased and the underscore separator is fixed. To preserve case you would need constant-case instead, and the hyphen form is a separate tool.

Free, online, and private

Free to use

snake_case is completely free. There is no account to create, no login, and no hidden charge or usage limit.

Runs online in your browser

It is a free online tool that runs entirely in your browser. Nothing to download or install — open the page and start using it right away.

Your data stays private

All processing happens locally on your device. Your input is never uploaded, stored, or tracked, so it never leaves your browser.

How snake_case behaves in detail

These are the specifics of this implementation — the exact ranges, defaults and fixed settings you are working with.

Parameter Value
Input one text panel, recalculated live on every keystroke; the sample reads Hello World Example
Output the text is split into words, lowercased, and joined by underscores
Splitting camelCase boundaries and hyphens, underscores, dots and slashes all act as word separators
Sample Hello World Example becomes hello_world_example
Collapse a run of whitespace becomes a single underscore, so double spaces do not produce double separators
Edges an empty panel returns an empty result, and a single word is simply lowercased

Compiled from the implementation of this tool and checked against it by itoolnet.

What snake_case does not do

Knowing the edges of a tool saves more time than another list of its features. These are the cases where it will not do what you might expect.

  • The transform is lossy. A space, a hyphen and a camelCase boundary all flatten into the same underscore, so hello-world, hello_world and HelloWorld all become hello_world and the original separator cannot be recovered.
  • Everything is lowercased and the separator is fixed. There is no option to preserve case, to use a different separator, or to produce the closely related constant-case form in the same run.
  • Digits are treated as part of a word rather than as boundaries. A run like Hello2World becomes hello2_world, which may not be the split a caller expects when numbers mark a version or an index.

Tested and documented by itoolnet, the team that builds and maintains this site.

Share & embed this tool

Writing a guide or article? You are welcome to link to snake_case with the snippet below. It is free, runs entirely in your browser, and needs no signup.