MiServe DevTools

Your lid

Pin tools here. They are saved in this browser.

Case Converter

Convert text between lowercase, UPPERCASE, Title Case and the naming styles of code: camelCase, PascalCase, snake_case, kebab-case and more.

The identifier styles and the slug are applied to each line separately.

lowercase
UPPERCASE
Title Case
Sentence case
camelCase
PascalCase
snake_case
SCREAMING_SNAKE_CASE
kebab-case
Train-Case
dot.case
path/case
URL slug

Runs in your browser. Nothing you paste is uploaded.

About this tool

How the text is split into words

Every identifier style starts the same way: the input is cut into words, and the words are joined again with a different separator and capitalisation. Anything that is not a letter or a digit separates words: spaces, punctuation, hyphens, underscores, dots and slashes. Inside a run of letters, a lowercase letter or a digit followed by a capital starts a new word, so fooBar is read as foo and Bar. Invisible characters inside a word, such as the soft hyphen that web pages use to break long words, are ignored instead of being read as a separator.

Acronyms are kept together. In a run of capitals, the last one starts a new word when a lowercase letter follows, so HTTPServer becomes http_server and parseXMLFile becomes parse_xml_file. Digits stay attached to the letters before them: sha256Hash becomes sha256_hash. An apostrophe between two letters is dropped, so don't gives dont.

The styles and where they are used

camelCase is the convention for variables and functions in JavaScript, Java and Swift. PascalCase names classes and types in many languages, and exported identifiers in Go. snake_case is the style of Python, Ruby and Rust variables and is common for SQL column names. SCREAMING_SNAKE_CASE is used for constants and environment variables. kebab-case appears in URLs, CSS class names and command-line flags, and Train-Case in HTTP header names such as Content-Type.

Title Case here capitalises every word. It does not apply the rules of a style guide that keep short words such as “of” or “and” in lowercase, because those rules differ between guides and between languages. Sentence case puts everything in lowercase and then a capital on the first letter of the text, of each line, and of whatever follows a full stop, question mark, exclamation mark or ellipsis and a space. It cannot tell a name or an abbreviation from an ordinary word, so Ask Dr. Smith becomes Ask dr. Smith: check proper nouns and acronyms afterwards.

The URL slug

The slug is the text reduced to lowercase ASCII letters and digits joined by single hyphens. Accents are removed by decomposing each letter with Unicode normalisation form NFKD and dropping the combining marks, so é becomes e. The same step turns ligatures and full-width letters into plain ones, so the single character fi becomes fi. Letters that do not decompose are spelled out: ß becomes ss, æ becomes ae, ø becomes o. Characters with no ASCII equivalent, such as Chinese or Arabic letters, are left out.

The other styles keep accented and non-Latin letters as they are. Upper and lower case follow the default Unicode mappings rather than the rules of your browser's language, so the result does not change with the language your browser is set to. One consequence is that ß in capitals is written SS, and the Turkish dotless ı and dotted İ are not paired the way Turkish spelling pairs them.

Questions

What is the difference between camelCase and PascalCase?

Both join the words without a separator and capitalise the first letter of each word. camelCase leaves the first word in lowercase, as in userName; PascalCase capitalises it as well, as in UserName.

How are acronyms such as HTTP or ID handled?

A run of capitals is read as one word, so getUserID becomes get_user_id and HTTPServer becomes http_server. In camelCase and PascalCase the acronym is written with one capital only, giving httpServer and HttpServer. If your style guide keeps acronyms in capitals, adjust those by hand.

Can I convert several names at once?

Yes. Put one name on each line. The identifier styles and the slug convert every line on its own and keep the line breaks, so a list of column names stays a list.

Is my text sent to a server?

No. The conversion is done by JavaScript in your browser tab. The tool makes no network request with what you type, and the site's security policy blocks requests to any other host.

More in Text