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. In 1893, the town had 13 shops and 5 alehouses. In 1894 an Orthodox church was built, and a synagogue had been founded several years earlier. In 1902 a Catholic church was established, followed by an Evangelical-Lutheran church in 1906. From 1899 to 1918 the town was called Muravyov.