● Developer Tools

Train Case Converter: Turn Any Text into Train-Case Online

Type or paste a phrase, sentence, or camelCase variable name below and it converts to Train-Case instantly β€” with one-click switches to kebab-case, PascalCase, camelCase and snake_case.

Your text or variable name
Words detected
Input characters
Output characters
Hyphens added

Every feature, at a glance

Everything this train case converter does, in one place.

-

Real-time Train-Case conversion

Converts your text to Train-Case instantly as you type or paste β€” no button to click.

kc

One-click kebab-case

Switch the same text to lowercase, hyphen-separated kebab-case with a single click.

Aa

PascalCase & camelCase

Also converts to PascalCase and camelCase for languages that prefer those conventions.

_

snake_case

One-click switch to underscore-separated snake_case for Python, Ruby and Rust code.

πŸ”

Smart word-boundary detection

Automatically splits camelCase and PascalCase input like "contentType" into separate words.

βœ‚

Cleans up messy input

Strips extra spaces, hyphens and underscores so mixed formatting still converts cleanly.

#

Numbers preserved

Digits within words are kept in place and treated as part of the surrounding word.

W

Live conversion stats

See word count, input/output character counts, and hyphens added as you type.

⧉

Copy & download

Copy the converted text to your clipboard or download it as a plain .txt file in one click.

πŸ”’

100% private

All conversion happens locally in your browser. Nothing you type is ever uploaded or stored.

∞

Free & unlimited

No signup, no paywall, no daily limit β€” use it as many times as you like.

β–’

Works on any device

Fully responsive layout that works the same on phone, tablet and desktop.

What is Train-Case, and what is this converter for?

Train-Case is a naming convention where every word in a phrase is capitalized and joined together with hyphens β€” turning "Content Type" or "contentType" into Content-Type. The name comes from the way each capitalized word looks like a train car linked to the next by a hyphen "coupler." This tool converts any input β€” plain sentences, hyphenated phrases, or camelCase/PascalCase variable names β€” into Train-Case instantly, entirely as JavaScript inside your browser. There's no upload and no server round-trip, so your text never leaves your device.

How word boundaries are detected

The converter splits your input wherever a new word logically begins: at spaces, hyphens, underscores, and at the transition from a lowercase letter to an uppercase letter (as in "contentType" β†’ "content" + "Type"). It also handles consecutive capitals correctly, so "XRequestedWith" becomes X-Requested-With rather than X-Requested-With split incorrectly letter by letter. Detected words are then capitalized and rejoined with hyphens.

Train-Case vs. kebab-case vs. PascalCase

Train-Case sits between the two: like kebab-case, it separates words with hyphens; like PascalCase, it capitalizes the first letter of every word. kebab-case keeps everything lowercase (content-type), while PascalCase removes the hyphens entirely (ContentType). Train-Case is the one you'll recognize instantly from HTTP headers.

Where Train-Case is used

  • HTTP headers β€” the defining example: Content-Type, Cache-Control, X-Requested-With.
  • COBOL identifiers β€” historically, COBOL programs commonly used hyphenated, capitalized names for data items.
  • CLI flag naming β€” some command-line tools display flags or option groups in Train-Case for readability.
  • Documentation headings β€” occasionally used to format compact technical labels or table headers.
  • Legacy systems & mainframe naming β€” inherited from environments where hyphens were valid but underscores or camelCase weren't.

Naming convention comparison

Case styleExampleCommon use
Train-CaseContent-TypeHTTP headers, COBOL identifiers
kebab-casecontent-typeURL slugs, HTML attributes, CSS classes
PascalCaseContentTypeClass names, C#/Java types, React components
camelCasecontentTypeJavaScript/Java variables & functions
snake_casecontent_typePython/Ruby/Rust variables, DB columns

Frequently asked questions

Related tools