Skip to content

snake_case Converter

Convert words or camelCase into snake_case, or CONSTANT_CASE with one tick. Paste many lines at once. Free developer tool.

Something not working? Report a problem

What is the snake_case Converter?

snake_case writes words in small letters with an underscore between them, like "user_first_name". It is the usual style in Python, Ruby and database column names.

Tick the box to make CONSTANT_CASE in capitals, which is used for fixed values. Each line is converted on its own.

How to use it

  1. Type or paste your text in the left box.
  2. The result shows on the right as you type. Each line becomes a snake_case name.
  3. Press Copy or Save to take the text away.

Why people like this tool

Many lines

Each line is converted by itself.

CONSTANT_CASE

One tick for all capital names.

Splits camelCase

userName becomes user_name.

Private

Nothing leaves your browser.

Examples

You typeYou get
user first nameuser_first_name
getTotalPriceget_total_price
background-colorbackground_color
max file size (CONSTANT_CASE ticked)MAX_FILE_SIZE

Where snake_case is used

  • Python: the official style guide (PEP 8) asks for snake_case in function and variable names.
  • Ruby and Rust: methods and variables use snake_case too.
  • Databases: table and column names like created_at or order_total are easy to read in SQL.
  • Fixed values: CONSTANT_CASE such as MAX_RETRIES is the common way to name values that never change.

Moving code from JavaScript to Python? Paste all the camelCase names, one per line, and copy the whole result in one go.

How it works, in one picture

Infographic: how to use the snake_case Converter in 3 easy steps: Add your text, Choose your options and Copy the result. You get: Many lines, CONSTANT_CASE, Splits camelCase and Private.

Frequently asked questions

What is snake_case?
It is a naming style with small letters and underscores between words, like "my_variable_name".
What is CONSTANT_CASE?
It is snake_case in capitals, like "MAX_FILE_SIZE". It is often used for values that never change.
Can I use it for database columns?
Yes. Most SQL databases like names in snake_case.
What is the difference between snake_case and kebab-case?
snake_case joins words with an underscore (my_page). kebab-case joins them with a hyphen (my-page). Use kebab-case for web addresses and CSS class names, and snake_case for variables in languages like Python.
Should I use underscores in a web address?
Hyphens are the better choice. Google advises hyphens to separate words in a URL, because it can then read each word on its own. Use the kebab-case converter for slugs.

You may also like