Trnava is first mentioned in a document of 1211. As early as 1238 it obtained its charter as a royal free borough. From 1432 to 1435 a Hussite garrison was stationed here. From 1541 to 1820, Trnava was the seat of an archbishop – the Primate of Hungary. From 1635 to 1777 it was a university town, which gradually attracted four faculties, and from 1792 the seat of the Slovak Learned Society. Trnava also became a centre of the first Slovak literary language – known as bernoláčtina. After the removal of the university to Buda (1777) and of the archbishopric to Esztergom (1820) the town declined in importance.
Comenius first journey to Sárospatak in 1650 also took him through Trnava, where he stayed for three days with the local Reformist minister Canizsay.