Mažeikiai was first mentioned in written sources in 1335. A chronicler of the Livonian Order wrote about a campaign of the Order, during which the land of Duke Mažeika was devastated. The town started growing rapidly in 1869 when the Libau–Romny Railway connecting Vilnius and Liepāja was constructed.