He was born at Hořiněves near Hradec Králové (Königgrätz). He was sent in 1807 to school at Hradec Králové, to escape the conscription, then to the University of Prague, where he founded a society for the cultivation of the Czech language. At Vienna, where he afterwards studied law, he established a Czech periodical; and in 1813 he made the acquaintance of Josef Dobrovský, an eminent philologist.
On 16 September 1817 Hanka claimed that he had discovered some manuscripts of 13th- and 14th-century Bohemian poems in the church tower of the town of Dvůr Králové nad Labem and later some more at Castle Grünberg (Zelená Hora) near Nepomuk. The Manuscripts of Dvůr Králové and of Zelená Hora (Czech: Rukopisy Královédvorský a Zelenohorský) were made public in 1818, with a German translation by Swoboda. The originals were presented by him to newly founded National Museum at Prague, of which he was appointed librarian in the same year. Great doubt, however, was felt as to their genuineness, and Dobrovský, by pronouncing the latter manuscript (also known as The Judgment of Libuše), to be an obvious fraud, confirmed the suspicion. Some years afterwards Dobrovský saw fit to modify his decision, but modern Czech scholars regard the manuscript as a forgery. A translation into English, The Manuscript of the Queen's Court, was made by Albert Henry Wratislaw in 1852.
In 1846 Hanka edited the Reims Gospel and made it available to the general public, for which he received the cross of the Order of St. Anna by the Tsar Nicholas I and a brilliant ring by Austrian Emperor Ferdinand I.
In 1848 Hanka, who was an ardent pan-Slavist, took part at the Prague Slavic Congress, 1848 and other peaceful national demonstrations, being the founder of the political society Slovanská lípa ("Slavonic Linden"). He was elected to the Imperial Diet at Vienna, but declined to take his seat. In the winter of 1848 he became lecturer and in 1849 professor of Slavonic languages in the University of Prague.
He died in Prague on 12 January 1861.
His chief works and editions are the following: