Train-Case Converter

Convert any text to Train-Case: every word capitalized, joined with hyphens. The style you see in HTTP header names like Content-Type.

Input
Output

What is Train-Case?

Train-Case writes each word with a capital first letter and joins the words with hyphens: Content-Type, User-Agent, Accept-Language. It's kebab-case with capitals, and it's also called HTTP-Header-Case.

Where Train-Case is used

  • HTTP header names: Content-Type, Cache-Control, X-Forwarded-For. This is where most people meet it.
  • Email header names: Reply-To, In-Reply-To.

Does capitalization matter in HTTP headers?

No. RFC 9110, the HTTP standard, says field names are case-insensitive, so content-type and Content-Type mean the same thing. Train-Case is a convention for readability, and HTTP/2 sends header names in lowercase on the wire. Some widely used headers also break the pattern, for example WWW-Authenticate and ETag, so copy those names exactly from their specifications.

How Train-Case conversion works

  1. Input is split into words by the same tokenizer as our other code cases, so camelCase, snake_case and CONSTANT_CASE input all work.
  2. Each word is lowercased, then its first letter is capitalized.
  3. Words are joined with a single hyphen.

An acronym is treated as one word, so HTTPServerError becomes Http-Server-Error.

Worked examples

Input Train-Case
content type Content-Type
userAgent User-Agent
X_FORWARDED_FOR X-Forwarded-For
cache-control Cache-Control
HTTPServerError Http-Server-Error

Related case formats

Need more conversion options?

Open the full converter →