Convert text to Train-Case (HTTP header case)

Train-Case capitalises every word and joins them with dashes. Paste content type and get Content-Type. The format is the canonical readable form for HTTP header names (Content-Type, X-Frame-Options) and capitalised slugs. For lowercase dashes, see kebab-case; for joined caps with no separator, see PascalCase; for underscore identifiers, see snake_case; for upper-snake env vars, see CONSTANT_CASE.

Input
Line 1:1 LF cloud_done Saved locally
Result Train-Case
0 lines 0 chars

Identifiers for HTTP headers

Train-Case (sometimes called HTTP-Header-Case) is the identifier style for HTTP header names: Content-Type, X-Frame-Options, Cache-Control, Set-Cookie. Every word starts with a capital, words are joined with single dashes, no other separators. RFC 7230 declares HTTP header names case-insensitive, but the convention is Train-Case for readability.

The engine tokenises your input the same way as the rest of the case family, then capitalises the first letter of each token and joins with -. content type becomes Content-Type. Mixed-format input (camelCase, snake_case, lowercase phrases) all produces the same Train-Case header.

Where it shows up: HTTP request and response headers, custom X- headers, some HTML data- attribute names that follow header conventions, and capitalised slug formats in older content management systems. For the lowercase variant used in URLs and CSS, use kebab-case; for the no-separator variant used in class names, use PascalCase; for the underscore variant used in Python and Ruby identifiers, use snake_case; for the all-caps environment-variable variant, use CONSTANT_CASE.

How to use convert text to train-case (http header case)

  1. 1Paste or type your phrase into the input panel on the left.
  2. 2The Train-Case header appears in the output panel on the right as you type.
  3. 3Mixed input is fine: contentType, content-type, and content_type all produce Content-Type.
  4. 4Click Copy in the output header to paste the header name into your code or HTTP client.
  5. 5For lowercase, use kebab-case; for joined caps, use PascalCase.

Keyboard shortcuts

Drive TextResult without touching the mouse.

Shortcut Action
Ctrl FOpen the find & replace panel inside the input Plus
Ctrl ZUndo the last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor Plus
EscClose find & replace, or exit fullscreen
Ctrl KOpen the command palette to jump to any tool Plus
Ctrl SSave current workflow draft Plus
Ctrl PRun a saved workflow Plus

What this tool actually does

Word boundary detection

Same tokeniser as camelCase. Underscores, dashes, whitespace, and lowercase-to-uppercase transitions all count as word boundaries, so any input format produces a consistent header.

Per-word capitalisation, dash join

Each token has its first letter uppercased and the rest left lowercase, then tokens are joined with a single dash. content type -> Content-Type. The pattern is the same as PascalCase with dashes between words.

Already-formatted input round-trips

Pasting Content-Type back in still produces Content-Type. The tokeniser splits on the existing dashes, lowercases each token, capitalises the first letter, and rejoins.

Multiple separators collapse

Runs of underscores, dashes, or spaces collapse to a single dash. content---type and content__type both produce Content-Type.

Pairs with the case family

Sibling tools share the same tokeniser. kebab-case for the lowercase variant, PascalCase for the no-dash variant, snake_case for code identifiers, CONSTANT_CASE for env vars.

Worked example

Spaces, dashes, and underscores all produce the same Train-Case result. The second line shows that input that already partly looks like a header (the leading x-) tokenises cleanly into X-Frame-Options.

Input
content type
x-frame options
user_profile_data
Output
Content-Type
X-Frame-Options
User-Profile-Data

Settings reference

Input Train-Case output
content type Content-Type
contentType Content-Type (boundary via lower-to-upper split)
content-type Content-Type
content_type Content-Type
CONTENT TYPE Content-Type
x-frame options X-Frame-Options

FAQ

Are HTTP headers actually case-sensitive?
No. RFC 7230 declares HTTP header names case-insensitive, so content-type, Content-Type, and CONTENT-TYPE all refer to the same header. Train-Case is convention, not requirement, and most HTTP clients accept any case. The tool produces the canonical readable form.
How is Train-Case different from kebab-case?
Train-Case capitalises every word (Content-Type); kebab-case is all lowercase (content-type). Both use dashes. Use Train-Case for HTTP headers, kebab-case for URLs and CSS class names.
Will it handle camelCase input?
Yes. The tokeniser splits on lowercase-to-uppercase transitions, so contentType produces Content-Type. Same for snake_case and other formats.
What about acronyms in headers like X-XSS-Protection?
The tokeniser does not preserve acronyms. X-XSS-Protection tokenises by lowercase-to-uppercase boundaries, then per-word title-cases, so the output becomes X-Xss-Protection. For acronym-preserving headers, run find and replace on the output to fix specific cases.
How do I convert to other identifier styles?
Use kebab-case for lowercase dashes, PascalCase for no separators, snake_case for underscores, CONSTANT_CASE for env vars, or dot.case for namespacing.