The most widely accepted theory recognizes the city's name as deriving from the Latin Via Regis ("Kings' Road"), the name of the medieval road linking the fortification built on the beach to Lucca.
According to other historians, instead, the name derives from Vicus Regius. This theory is based on the fact that in imperial times, there was a small inhabited centre (vicus) in the area known as "Gli Ortacci" which belonged to the empire, hence regius ("Royal").
Several hillside towns started developing in the middle Ages, several of which are still active. The area currently hosting the city of Viareggio, was still marshland and was not inhabited. Around 1000 A.D. started the first hostilities between Lucca and Pisa aimed at gaining control over the coast of the Versila which, since the High Middle Ages had been nothing more than a wood owned by feudal Lords in constant rivalry with each other.
The first mention of Viareggio dates back to 1169 when a wooden tower guarding coast was built. A little over two years later, in (1172) a military building named Turris de Via Regia was erected, taking its name from the road that linked it to Lucca (known today as via Montramito). In the following years the area around Viareggio, was involved in the hostilities between Pisa and Lucca and in their attempt to gain control over the coastal area.
In these years Florence expanded its control over Tuscany. Lucca, however, managed to maintain its independence in exchange for hefty financial penalties.
On September 10, 1513, Pope Leo X removed the port of Motrone from the control of Lucca. Such event will directly affect the future of Viareggio which, from that moment, became the focus of Luccas efforts to turn the town into its centre for commercial activities, and, in addition to the square-plan tower erected in (1534) with the aim to protect the port, several settlements started appearing.
The 17th century was perhaps one of the most difficult periods for the 300 inhabitants of Viareggio; the area was insalubrious, malaria and other deadly epidemic diseases made the lives of fishermen and farmers extremely difficult. Lucca, on the other hand, increased its efforts to drain the marshlands to improve quality of life and encouraged migration to the new town.
Slowly Viareggio changed its appearance; two small churches and as many factories were built, followed by a number of small shops. Meanwhile its port became more active, while the cultivation of the drained fields started.
In 1701 Viareggio became a comune (municipality). In 1739, thanks to the work of hydraulics engineer Bernardino Zendrini the marshlands were finally completely drained.
With the invasion of Italy by Napoleon the Lucchese state was turned into a principality whose sovereignty was given to Felice Baciocchi, although the real power was in the hands of Napoleons older sister, Elisa. With the fall of Napoleon and Baciocchi, Viareggio was the centre of several acts of violence. In March 1814 the population openly protested against the French, an event which turned into acts of pure vandalism.
Viareggio remained under the control of the Austrians until 1817 when, as part of the agreements from Congress of Vienna, Mary Louisa of Spain was assigned the new Duchy of Lucca. The years to come would wipe out any good action that had been taken during the Napoleonic rule, although the new ruler would contribute the towns expansion by building its first marina (seaside). In 1820 Viareggio obtained the status of city.
Following the death of his mother (13 March 1824), Charles Louis of Parma took over the government of Lucca and greatly contributed to Viareggios expansion, by building a new church, a royal casino and two beach resorts, the first ones to be built in Viareggio.
On October 5, 1847 Lucca was acquired by the Grand Duchy of Tuscany. Viareggio, in this new scenario, developed as a seaside resort for the whole of Tuscany. In 1848 the city adopted its current coat of arms. In these years Viareggio was the destination of many exiled intellectuals of the Italian Risorgimento who were tolerated by the local sovereigns.
During these years Viareggios economy saw a very rapid expansion through its already recognized beach tourism and the newly expanding sailboat industry.
The beginning of the 20th century saw again a marked development of the coast and tourism industry which determined a drastic change to most of the beach. The Passeggiata or promenade was born, with its cafés and shops, contributing to turning the city into the "Pearl of the Tyrrhenian Sea". Wood was very widely used in most building and, in 1917, a large portion of the city was lost in fire in only one night. It was only during the fascist era that wood would finally be replaced by other materials.
During World War II Viareggio was subject to heavy bombings and entire suburbs of the city were destroyed.
After the war, the reconstruction could finally begin, but the city had changed its appearance dramatically. Today Viareggio is still a renowned seaside resort and is widely famous for its carnival and shipbuilding industry.