Title case is the capitalisation style used for headlines, book and article titles, and headings. The widely followed AP and Chicago styles agree on the core rule: capitalise the important words and leave a small set of short function words lowercase, with the first and last word always capitalised.
How it works
Each line is split into words. A word is capitalised unless it is in the “small words” list — articles, coordinating conjunctions, and short prepositions — in which case it stays lowercase. Two exceptions override that:
- First word of the title -> always capitalised
- Last word of the title -> always capitalised
- Word after ':' or ';' -> always capitalised (subtitle rule)
- Each part of a hyphenated -> capitalised individually
The algorithm walks the words, capitalising the first alphabetic character of each major word and lowercasing the rest, so ordinary words are normalised while the structural lowercase words are preserved.
Tips and example
The input “the lord of the rings: a guide to middle-earth” becomes “The Lord of the Rings: A Guide to Middle-Earth”. Notice that “of”, “the”, and “to” stay lowercase as small words, “A” is capitalised because it follows a colon, and “Middle-Earth” capitalises both halves of the hyphenated compound. If your house style differs — some publications also lowercase “as” or capitalise all prepositions over three letters — adjust the result by hand after conversion.