Code Case Converter

Convert identifiers between camelCase, snake_case, PascalCase, kebab-case and more.

One per line. Any casing is accepted.

100 runs left today · sign up for more

About this tool

Converts identifiers between the casing conventions code uses: camelCase, PascalCase, snake_case, SCREAMING_SNAKE_CASE, kebab-case and dot.case.

The hard part is splitting the input, not joining it. `parseXMLDocument` is three words — parse, XML, document — and a naive split on capital letters gives you `parse_x_m_l_document` or `parse_xmldocument` depending on which way it fails. The boundary has to fall between the last capital of an acronym and the capitalised word after it.

This is for identifiers. For prose titles and headings, the text case converter is the right tool.

Common questions

How are acronyms handled?

A run of capitals is one word, and the boundary falls before the last capital when a lowercase letter follows it. So parseXMLDocument becomes parse_xml_document, not parse_xmldocument or parse_x_m_l_document.

What is the difference between camelCase and PascalCase?

Only the first letter. camelCase starts lowercase and is the usual convention for variables and methods; PascalCase starts uppercase and is conventional for class names.

Which should I use for a database column?

snake_case, almost always. Most databases fold unquoted identifiers to one case, so a camelCase column ends up needing quoting everywhere and is easy to get wrong.

Are digits treated as part of a word?

Yes. utf8Encoder becomes utf8_encoder rather than utf_8_encoder, since splitting a number away from the letters it belongs to almost always produces something wrong.