Case Converter

Convert text or identifiers between UPPER, lower, Title, camelCase, PascalCase, snake_case and kebab-case, with acronyms and underscores split correctly.

The interactive tool loads here when JavaScript runs.

About this tool

What is the Case Converter?

The Case Converter rewrites text in seven styles: UPPER, lower, Title, camelCase, PascalCase, snake_case and kebab-case. Paste a phrase or identifier, click a style, and copy the result.

For the four identifier styles it first splits the input into words. Spaces, punctuation, hyphens and underscores separate words, and so do camelCase humps and acronym boundaries, so getHTTPResponseCode becomes get_http_response_code. Each line is converted separately, which lets you paste a column of names and convert them all at once.

UPPER, lower and Title change letter case only and keep your spacing and punctuation. Title capitalizes the first letter of every word; it does not follow AP or Chicago rules for short words.

  • Seven case styles in one place
  • Splits words on spaces, punctuation, hyphens, underscores, camelCase humps and acronyms
  • Converts each line separately
  • One-click copy; runs locally in your browser
Read the guide: camelCase, snake_case, kebab-case: Naming Conventions Across Languages

Updated

How to use the Case Converter

  1. Paste your text into the input box, one identifier per line if you have several.
  2. Click a style: UPPER, lower, Title, camelCase, PascalCase, snake_case or kebab-case.
  3. Click Copy Result.
  4. Use Clear to start again.

Worked examples

Database column to JavaScript property

Input

created_at

Output

camelCase: createdAt; PascalCase: CreatedAt; kebab-case: created-at

Underscores count as word breaks, so the two words are recognized before the new style is applied.

An identifier with an acronym

Input

getHTTPResponseCode

Output

snake_case: get_http_response_code; camelCase: getHttpResponseCode

HTTP is kept together as one word instead of becoming h_t_t_p. Going back to camelCase gives Http, which is what many style guides prefer for long acronyms.

Background and insight

Naming conventions are mostly ecosystem habits that hardened into rules. C and Unix favoured lower case with underscores, which Python later adopted in PEP 8 for functions and variables. Smalltalk popularized camelCase, which Java and JavaScript inherited. Pascal and later C# made PascalCase the norm for types. Lisp and the web settled on kebab-case, which is why CSS properties, HTML attributes and URL slugs use hyphens.

The conventions matter most at boundaries. A JSON API written in Python may emit created_at while the JavaScript client expects createdAt, and teams have to decide where to convert. URLs are another boundary: Google's guidance recommends hyphens rather than underscores to separate words in URLs.

Acronyms are the hardest part of case conversion. Should it be XMLHttpRequest, XmlHttpRequest or xml_http_request? Style guides disagree; Microsoft's .NET guidelines, for example, keep two-letter acronyms upper case (IO) and capitalize only the first letter of longer ones (Xml). This converter treats a run of capitals as one word and writes it as Xml in PascalCase, so check names your style guide spells differently.

Common use cases

  • Mapping API fields

    Convert snake_case database columns to camelCase properties for a TypeScript interface.

  • Naming CSS classes and files

    Turn a component name into kebab-case for a class name or filename.

  • Cleaning up headings

    Convert shouted ALL CAPS text to lower or Title case.

  • Creating constants

    Convert a phrase to snake_case and then UPPER to get an environment variable name.

Tips and limitations

  • Digits stay attached to the word before them: version2Api becomes version2_api.
  • Accented and non-Latin letters are kept, which is fine for prose but may not be valid in identifiers for every language.
  • Title case does not split identifiers. Convert created_at to kebab-case or snake_case first if you want separate words.
  • If your codebase writes IDs as ID (userID), fix those by hand after converting; the converter produces userId.
  • Converting long paragraphs to camelCase joins every word on a line; the identifier styles are meant for names, not prose.

Sources and further reading

  1. PEP 8: Style Guide for Python Code, Python Software Foundation. snake_case for functions and variables
  2. Capitalization Conventions, Microsoft Learn. PascalCase, camelCase and two-letter acronyms in .NET
  3. Google Java Style Guide, Google. How Google's Java style handles acronyms in camel case
  4. URL structure best practices for Google Search, Google Search Central. Hyphens rather than underscores in URLs

Frequently asked questions

What is the difference between camelCase and PascalCase?

camelCase starts with a lower-case letter (userName) and PascalCase starts with a capital (UserName). JavaScript, Java and TypeScript use camelCase for variables and functions, and PascalCase for classes, types, interfaces and React components. C# also uses PascalCase for public methods.

When should I use snake_case instead of kebab-case?

Use snake_case where identifiers must be valid variable names, as in Python, Ruby, Rust and SQL columns. Use kebab-case where hyphens are allowed and conventional: CSS classes, HTML attributes, command-line flags, file names and URL slugs. A hyphen is a minus sign in most programming languages.

How does the case converter handle acronyms like API or HTTP?

A run of capital letters is treated as one word, and a capital followed by lower-case letters starts the next word. So parseHTMLString becomes parse_html_string, and back to camelCase it becomes parseHtmlString. Fix acronyms by hand if your style guide keeps them upper case.

Does Title case follow AP or Chicago style?

No. Title capitalizes the first letter of each word and lower-cases the rest. Editorial styles such as AP and Chicago also keep short words like "of", "and" and "the" in lower case unless they start the title, so adjust those by hand for headlines.

What case should environment variables use?

SCREAMING_SNAKE_CASE, such as DATABASE_URL or STRIPE_API_KEY, by long Unix convention. With this tool, convert your phrase to snake_case first and then click UPPER, which gives the same result in two clicks.

Is there an in-depth guide to the Case Converter?

Yes. “camelCase, snake_case, kebab-case: Naming Conventions Across Languages” covers the background, how it works, common pitfalls and worked examples. Read the full guide.