Snake Case Converter
Paste names or phrases, one per line, to turn them into snake_case (first_name) or SCREAMING_SNAKE_CASE (FIRST_NAME). camelCase, PascalCase, kebab-case, dots and spaces are all split into words.
0 words 0 characters 0 lines
Continue with this text: camelCasekebab-caseSlug
Your text stays in your browser: nothing is uploaded or stored on a server.
How to use the snake case converter
- Paste or type your names in Your text, one per line. Click Example to load a sample, or Open file to read a .txt or .csv file.
- Under Style, choose snake_case for lowercase names or SCREAMING_SNAKE_CASE for capitals.
- The Result box updates as you type. Each input line gives one output line.
- Click Copy or Download .txt, or continue with the result in the camelCase, kebab-case or slug tools.
The two styles
| Input | snake_case | SCREAMING_SNAKE_CASE |
|---|---|---|
firstName |
first_name |
FIRST_NAME |
HTTPResponseCode |
http_response_code |
HTTP_RESPONSE_CODE |
max retry count |
max_retry_count |
MAX_RETRY_COUNT |
Order-Total |
order_total |
ORDER_TOTAL |
Both styles split the text into the same words; only the letter case differs. Which one to use depends on the convention of your language or project. Python’s style guide, PEP 8, asks for lowercase with underscores for function, variable and method names and for capitals with underscores for module-level constants such as MAX_OVERFLOW. The Rust API Guidelines use snake_case for modules, functions, methods, macros and local variables, and SCREAMING_SNAKE_CASE for constants and statics.
How the converter finds the words
Each line is split into words, then the words are lowercased (or uppercased) and joined with single underscores. A new word starts:
- At any character that is not a letter or digit: spaces, tabs, hyphens, dots, slashes, commas, brackets and existing underscores. Several in a row count as one break, and breaks at the start or end of a line are dropped, except underscores: leading and trailing underscores are kept, so
_private_varand__init__stay as they are. - Not at an apostrophe inside a word: straight and curly apostrophes between letters are removed, so
don't stopbecomesdont_stopanduser’s namebecomesusers_name. - Where a lowercase letter or digit is followed by a capital:
firstName→first,Name;version2Beta→version2,Beta. - Before the last capital of a run of capitals followed by a lowercase letter:
HTTPResponse→HTTP,Response. That is how acronyms stay in one piece.
Digits stay attached to the letters before them, so utf8Encode becomes utf8_encode and base64Encode becomes base64_encode. Text that is already in snake_case passes through unchanged, and SCREAMING_SNAKE_CASE input such as API_KEY simply becomes api_key.
| Before | After (snake_case) |
|---|---|
getUserByID |
get_user_by_id |
XMLHttpRequest |
xml_http_request |
parseJSON |
parse_json |
IOError |
io_error |
IPv6Address |
ipv6_address |
Total Revenue (USD) |
total_revenue_usd |
zip/postal code |
zip_postal_code |
order.total |
order_total |
Q3 2026 Sales |
q3_2026_sales |
Edge cases to check by hand
The rules above work for most real names, but a few inputs give results you may want to edit:
| Before | After | What happened |
|---|---|---|
iPhone |
i_phone |
A brand written with a lowercase first letter is split at the capital. |
rock 'n' roll |
rock_n_roll |
Quotes around a word are not inside a word, so they only separate words. |
2fa_code |
2fa_code |
A name can start with a digit; many languages do not allow that in identifiers. |
emoji 😀 test |
emoji_test |
Emoji and symbols are dropped like other punctuation. |
Letters from any alphabet are kept, accents included: café au lait becomes café_au_lait and ДобрыйДень becomes добрый_день. If your database or language only accepts ASCII names, run the text through Remove accents first. In SCREAMING_SNAKE_CASE the German ß becomes SS (straße → STRASSE), which is the standard uppercase form.
Line breaks are kept and Windows line endings are written as plain line feeds. A line that contains only spaces or punctuation becomes an empty line, so the output always has as many lines as the input.
When people need snake_case
- Database columns. Spreadsheet headers such as Email Address or Total Revenue (USD) become
email_addressandtotal_revenue_usd, ready for aCREATE TABLEstatement. In PostgreSQL this also avoids quoting: unquoted identifiers are folded to lowercase, so a column created as"FirstName"must be quoted in every query, whilefirst_namenever needs quotes. - Moving code between languages. A JavaScript or Java API returns
createdAtanduserId; a Python model expectscreated_atanduser_id. Paste the field list, one per line, and copy the result. - Environment variables and constants. Switch to SCREAMING_SNAKE_CASE to turn
database urlorapiKeyintoDATABASE_URLandAPI_KEY. - File names and keys. Translation keys, analytics event names and file names often use snake_case because it contains no spaces and reads well.
For a list that arrives on one line, separated by commas, split it into lines first: first name, last name, email on one line becomes a single name, first_name_last_name_email. The comma separator can turn a comma list into lines and back.
snake_case, camelCase and kebab-case
All three cases join the same words; they differ in the separator and in capitals. snake_case uses underscores and lowercase, camelCase removes the separators and capitalizes every word after the first, and kebab-case uses hyphens. Hyphens are not allowed in most programming identifiers because they read as a minus sign, which is why kebab-case is used for CSS classes and URLs rather than variables. The guide camelCase vs snake_case vs kebab-case compares where each is used.
One thing does not survive a round trip: snake_case does not record which words were acronyms. HTTPResponseCode becomes http_response_code, and converting that back with the camelCase converter gives httpResponseCode, not the original. Keep the original names if you need them later.
Questions
How do I convert camelCase to snake_case?
Paste the camelCase names, one per line, and keep the snake_case style selected. A new word starts wherever a lowercase letter or digit is followed by a capital, so firstName becomes first_name and getUserByID becomes get_user_by_id.
What is SCREAMING_SNAKE_CASE?
The same words joined by underscores but in capitals, such as MAX_RETRY_COUNT. Python's PEP 8 and the Rust API Guidelines use it for constants, while functions and variables use lowercase snake_case.
Can I convert a whole list of column names at once?
Yes, if each name is on its own line. Every line is converted separately and empty lines are kept. Names separated by commas on one line are joined into one long name, so put them on separate lines first, for example with the comma separator.
How do I convert snake_case back to camelCase?
Use the camelCase converter. It splits at the underscores, so user_id becomes userId. Acronyms do not come back in capitals, because snake_case no longer records them.
Does it keep leading underscores like _private or __init__?
Yes. Underscores at the very start and end of a line are kept, so _private_var stays _private_var and __init__ stays __init__ (in SCREAMING_SNAKE_CASE, __INIT__). Underscores inside a name only separate words, and a run of them becomes one, so a__b becomes a_b.
How would I do this in Python or JavaScript?
A common approach is a regular expression that inserts an underscore before each capital and then lowercases the result, but simple patterns split acronyms letter by letter (H_T_T_P). This tool also keeps runs of capitals such as HTTP or ID together, which is handy for checking what your own code should produce.
Is my text sent anywhere?
No. The conversion runs in your browser and nothing is uploaded.