PascalCase to snake_case converter

Paste PascalCase class or model names and get them back in lowercase snake_case.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter pascalcase names (one per line or inside text).
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

Each PascalCase name is split into words at every change from a lowercase letter or digit to a capital, and before the last capital of an acronym that is followed by a lowercase letter. The words are then lowercased and joined with underscores (_). Symbols and spaces around the names are left as they are. Example: UserProfile becomes user_profile.

Example

Result: snake_case result: user_profile order_line_item xml_http_request; Names processed: 3.

UserProfile
OrderLineItem
XMLHttpRequest
user_profile
order_line_item
xml_http_request

Limits and caveats

  • A name with no capital to mark the word break, such as username or an Arabic name, cannot be split.
  • Digits stay attached to the letters before them, so item2Count is read as item2 and Count.
  • Converting back may not restore the original exactly: an acronym such as HTML comes back as Html.

Questions about this tool

Where is this conversion used?

In Ruby on Rails, for example, the class UserProfile lives in user_profile.rb, and in Python modules are named in lowercase with underscores while classes stay in PascalCase.

How is XMLHttpRequest split?

Into XML, Http and Request, giving xml_http_request, because the last capital before a lowercase letter starts a new word.

Is a plural s added for table names?

No, only the writing style changes; turning User into users is a pluralisation rule that differs by framework and language.