String Case Converter

Convert identifiers between camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE and 9 more, with smart acronym handling.

Runs in your browser

Input

On: version2Beta → version_2_beta. Off: version2Beta → version2_beta.

camelCase

The converted text appears here.

What is a string case converter?

Programming languages and file formats have strong naming conventions. JavaScript variables use camelCase, classes and React components use PascalCase, PHP and WordPress functions, Python and database columns use snake_case, constants use SCREAMING_SNAKE_CASE, and URLs, CSS classes and npm packages use kebab-case. Moving names between layers — a JSON API in camelCase, a MySQL table in snake_case, CSS in kebab-case — means converting them constantly.

This converter first splits the input into words, then rebuilds it in the target case. Word boundaries are found at spaces and punctuation, at underscores, hyphens, dots and slashes, at lowercase-to-uppercase changes (firstName), and at acronym boundaries, so XMLHttpRequest becomes xml, http, request rather than one long word. Each line is converted separately, which makes it easy to transform a whole list of field names at once.

How to use the String Case Converter

  1. Paste or type your text. Put each identifier on its own line to convert a list.
  2. Choose the target case from the list. Your choice is remembered.
  3. Optionally tick Split letters and numbers to treat digits as separate words.
  4. Copy or download the converted output, or copy any single row from the All cases table.

Example

The input getHTTPResponseCode converts to:

camelCase             getHttpResponseCode
PascalCase            GetHttpResponseCode
snake_case            get_http_response_code
SCREAMING_SNAKE_CASE  GET_HTTP_RESPONSE_CODE
kebab-case            get-http-response-code
Train-Case            Get-Http-Response-Code
dot.case              get.http.response.code

Which case is used where?

  • camelCase — JavaScript/TypeScript variables and functions, JSON keys in most APIs, Java methods.
  • PascalCase — classes in most languages, React components, C# methods and properties.
  • snake_case — PHP and WordPress functions and hooks (get_post_meta), Python, Ruby, SQL tables and columns.
  • SCREAMING_SNAKE_CASE — constants and environment variables (WP_DEBUG, DATABASE_URL).
  • kebab-case — URLs and slugs, CSS classes, HTML attributes, file names, npm package names.
  • COBOL-CASE / Train-Case — HTTP header names use Train-Case (Content-Type); COBOL-CASE appears in legacy code.
  • dot.case / path/case — configuration keys (app.cache.ttl), translation keys and file paths.

Frequently Asked Questions

How are acronyms like HTML or API handled?

A run of capitals followed by a capitalised word is split before the last capital, so parseHTMLString becomes parse, html, string. Acronyms are then cased like normal words (parseHtmlString in camelCase), which is the convention recommended by most style guides because it keeps word boundaries readable.

What happens to numbers?

By default digits stay attached to the preceding letters, so base64Encode becomes base64_encode. Enable Split letters and numbers to get base_64_encode instead.

Why is punctuation removed?

The tool is designed for identifiers, so punctuation is treated as a word separator. To change the case of normal sentences while keeping punctuation, use the Case Converter.

How is Title Case different from Train-Case?

Title Case separates words with spaces and keeps short words such as “of”, “and” and “the” lowercase in the middle of a phrase. Train-Case capitalises every word and joins them with hyphens.

How do I make a URL slug?

kebab-case is close, but a proper slug also transliterates accented characters. The Slug Generator handles that for URLs and WordPress permalinks.