Skip to content
Case Converter Online
en

Snake Case Converter

Convert words, camelCase or kebab-case into snake_case. Paste a single name or a full list of fields.

Characters
0
Words
0
Sentences
0
Lines
0

Convert to

For code

Runs in your browser. Your text is never uploaded.

What snake_case is

snake_case replaces the spaces between words with underscores and keeps every letter lowercase:

  • First Name becomes first_name
  • orderTotalAmount becomes order_total_amount
  • is-logged-in becomes is_logged_in

It is one of the easiest naming styles to read, because the underscore leaves a visible gap between words.

How the converter works

The tool finds the words in each line, lowercases them and joins them with underscores. It recognizes words separated by spaces, hyphens, dots or slashes, and it also splits camelCase and PascalCase names at their capital letters. Runs of capitals are kept together, so parseHTMLString becomes parse_html_string.

Every line is converted on its own, so you can paste a full list.

Input Output
User First Name user_first_name
orderTotalAmount order_total_amount
background-color background_color
GetUserByID get_user_by_id
Date of birth date_of_birth

Where snake_case is used

  • Python: variables, functions and module names, as recommended by PEP 8
  • Ruby: variables, methods and file names
  • Rust: variables, functions and modules
  • SQL databases: table and column names such as created_at
  • File names: where spaces cause trouble in scripts and URLs

JavaScript and Java use camelCase for the same purpose, which is why converting between the two comes up so often when a frontend talks to a backend.

snake_case and its relatives

Style Example Typical use
snake_case max_retry_count Variables, columns
CONSTANT_CASE MAX_RETRY_COUNT Constants, environment variables
kebab-case max-retry-count URLs, CSS classes
camelCase maxRetryCount JavaScript variables

For constants and .env files, press CONSTANT_CASE in the tool. For URLs, use kebab-case. Search engines treat hyphens as word separators, which makes them the better choice in web addresses.

Tips for clean names

  • Keep names short but complete: user_email is better than ue or the_email_address_of_the_user.
  • Avoid a leading number. Most languages do not allow a name to start with a digit.
  • Be consistent across a project. Mixed styles are harder to search and easier to mistype.

Snake Case Converter: questions and answers

What is snake case?

Snake case writes a multi-word name in lowercase with underscores between the words, as in first_name or total_order_count. The underscores sit low on the line like a snake on the ground, which is where the name comes from.

How do I convert camelCase to snake_case?

Paste the camelCase names into the box. The converter finds each capital letter that starts a new word, adds an underscore before it and lowercases everything. userFirstName becomes user_first_name.

What is SCREAMING_SNAKE_CASE?

It is snake case written in capitals, as in MAX_RETRY_COUNT. It is used for constants and environment variables. Press the CONSTANT_CASE button in the tool to get it.

Does Python require snake case?

Python does not enforce it, but PEP 8, the official style guide, recommends lowercase names with underscores for variables and functions. Almost all Python code follows that advice.

More code and data tools

See all tools