snake_case Converter

Lowercase words joined with underscores, like user_first_name.

0 words · 0 characters

Example

Before
User First Name
shippingAddressLine
OrderTotal
After
user_first_name
shipping_address_line
order_total

Where snake_case is used

snake_case is the convention for variables and functions in Python and Ruby, and for table and column names in most SQL databases.

CONSTANT_CASE

Many languages write constants in uppercase snake case, such as MAX_RETRIES. Convert to snake_case here, then run the result through the Uppercase converter.

Why databases like snake_case

Many databases treat unquoted names case-insensitively. PostgreSQL, for example, folds unquoted identifiers to lowercase, so a column created as FirstName is stored as firstname unless you quote it everywhere. Lowercase names with underscores avoid that trap and stay readable, which is why first_name is the most common style for SQL tables and columns.

Language conventions

Python’s style guide (PEP 8) uses snake_case for functions, variables, and modules, and so do Ruby, Rust, and PHP’s standard library. It is also common for file names in Python projects and for environment variable names when written in capitals (DATABASE_URL).

Frequently asked questions

How do I get SCREAMING_SNAKE_CASE?

Convert here, then run the result through the Uppercase converter.

Does it split camelCase input correctly?

Yes. shippingAddressLine becomes shipping_address_line.

What happens to punctuation and accents?

Punctuation counts as a word break and is removed; letters and digits are kept.

What happens to leading underscores and apostrophes?

Anything that is not a letter or digit is a separator, and separators at the start or end are dropped. _privateField becomes private_field, and “it’s done” becomes it_s_done, so remove apostrophes first if you don’t want that extra word.

How are numbers handled?

Digits stay attached to the letters before them. HTTPServer2 Config becomes http_server2_config. A number standing on its own, as in “user id 42”, becomes its own word: user_id_42.

Can I convert a whole list of column names?

Yes. Put one name on each line. Each line is converted separately, which makes it quick to rename a set of spreadsheet headers for a database table.

How do I convert snake_case to camelCase?

Paste the snake_case names into the camelCase Converter. It reads the underscores as word breaks and returns userFirstName style names.