By Docify

snake_case Converter: Spaces Become _

• 5 min read

Docify's snake_case card lowercases the input, then replaces one or more whitespace characters with _. It does not split camelCase, hyphens, or existing underscores. User Profile Data becomes user_profile_data; getUserData becomes getuserdata. Copy writes that card to the clipboard. Nothing is uploaded.

snake_case as a naming convention (Python variables, many SQL columns) is separate from what this page computes. The case converter is a whitespace replacer, not a hump splitter. PEP 8 still asks for snake_case on Python functions — you may need to insert spaces before converting camelCase.

How to get snake_case from spaced words

Step 1: Use spaces as the separators

Type or paste a phrase. The snake_case card updates as you type. There is no format dropdown.

User Profile Data

Step 2: Read the snake_case card

The page runs str.toLowerCase().replace(/\s+/g, '_'). One or more spaces, tabs, or newlines become a single underscore.

Step 3: Copy the card

Copy writes that string to the clipboard. There is no download.

user_profile_data

What actually converts

Inputsnake_case card
User Profile Pageuser_profile_page
calculate total pricecalculate_total_price
getUserDatagetuserdata
UserProfileDatauserprofiledata
user-profile-pageuser-profile-page

The last three rows are the usual surprise. camelCase and PascalCase collapse to one lowercase word. kebab-case keeps its hyphens. For the other seven mappings, see How each of the eight cases is computed.

kebab-case on the same input

kebab-case is toLowerCase().replace(/\s+/g, '-'). Hello World Example becomes hello-world-example. It is not a URL slugger beyond that replacement, and it does not strip punctuation.

What this page does not do

A dedicated Python or SQL mode

PEP 8 and common database naming still prefer snake_case. The tool does not validate identifiers, reserve words, or class-name PascalCase. Python classes stay a human convention.

SCREAMING_SNAKE_CASE

Constants such as MAX_CONNECTION_TIMEOUT are not a card. Use snake_case, then the UPPERCASE card, only if you first have spaces (or add them). UPPERCASE alone keeps the spaces.

Convert spaced words to snake_case

Lowercase, then whitespace to _. Not a camelCase splitter. Nothing is uploaded.

Use Case Converter →

FAQ

Does the snake_case card upload my text?
No. The preview and Copy run in your browser. The page does not send the text to a server.
Does snake_case split camelCase or kebab-case?
No. After toLowerCase(), only one or more whitespace characters become _. "getUserData" becomes "getuserdata". "user-profile-page" stays "user-profile-page". Existing underscores are left as-is.
How is kebab-case different on this page?
kebab-case is the same whitespace replacement with - instead of _. It also does not split camelCase. Hyphens already in the input stay hyphens on both cards.
Is there a SCREAMING_SNAKE_CASE output?
No. The UPPERCASE card keeps spaces ("HELLO WORLD"). snake_case is lowercase. There is no constants mode that emits HELLO_WORLD.

Related