#title #case #capitalization #capitalisation #capitalize

bin+lib titlecase

A tool and library that capitalizes text according to a style defined by John Gruber for post titles on his website Daring Fireball

8 releases (5 stable)

2.2.1 Oct 6, 2022
2.2.0 Sep 3, 2022
2.1.0 Aug 30, 2022
2.0.0 Jun 15, 2022
0.9.1 Jun 19, 2017

#58 in Text processing

Download history 4470/week @ 2023-08-09 4741/week @ 2023-08-16 4863/week @ 2023-08-23 5827/week @ 2023-08-30 5608/week @ 2023-09-06 5876/week @ 2023-09-13 6981/week @ 2023-09-20 6904/week @ 2023-09-27 5120/week @ 2023-10-04 6046/week @ 2023-10-11 6804/week @ 2023-10-18 6168/week @ 2023-10-25 5560/week @ 2023-11-01 5138/week @ 2023-11-08 6381/week @ 2023-11-15 4105/week @ 2023-11-22

22,122 downloads per month
Used in 33 crates (18 directly)

MIT license

340 lines

Title Case (titlecase)

titlecase is a small tool and library (crate) that capitalizes English text according to a style defined by John Gruber for post titles on his website Daring Fireball. titlecase should run on all platforms supported by Rust including Linux, macOS, FreeBSD, NetBSD, OpenBSD, and Windows.

Build Status crates.io Documentation

titlecase is licensed under the MIT license.


% echo 'Being productive on linux' | titlecase
Being Productive on Linux

% echo 'Finding an alternative to Mac OS X — part 2' | titlecase
Finding an Alternative to Mac OS X — Part 2

% echo 'an example with small words and sub-phrases: "the example"' | titlecase
An Example With Small Words and Sub-Phrases: "The Example"

Command Line Usage

titlecase reads lines of text from stdin and prints title cased versions to stdout.

Usage as a Rust Crate

See the crate documentation.


Minimum Supported Rust Version: 1.40.0

If you have a stable Rust compiler toolchain installed you can install the most recently released titlecase with cargo:

% cargo install titlecase


Instead of simply capitalizing each word titlecase does the following (amongst other things):

  • Lower case small words like an, of, or in.
  • Don't capitalize words like iPhone.
  • Don't interfere with file paths, URLs, domains, and email addresses.
  • Always capitalize the first and last words, even if they are small words or surrounded by quotes.
  • Don't interfere with terms like "Q&A", or "AT&T".
  • Capitalize small words after a colon.


This tool makes use of prior work by John Gruber, Aristotle Pagaltzis, and David Gouch.


~54K SLoC