Great Fantasia and Fugue in G minor, BWV 542

The Great Fantasia and Fugue in G minor, BWV 542, is an organ prelude and fugue by Johann Sebastian Bach. It acquired that name to distinguish it from the earlier Little Fugue in G minor, which is shorter. This piece is not to be confused with the Prelude and Fugue in A minor, which is also for organ and also sometimes called "the Great".

Bach's biographer Spitta and some later scholars think that the Fugue was improvised in 1720 during Bach's audition for an organist post at St. James' Church in Hamburg. Assuming this is correct, the theme or subject of the Fugue, a Dutch popular tune (called 'Ik ben gegroet van...'), would have been given to Bach for him to demonstrate his talents as an improviser. It has been suggested by musicologist Christoph Wolff that the choice of a Dutch tune was in homage to Johann Adam Reincken, the long-serving organist at St. Catherine's Church, Hamburg, who was born in the Netherlands. During his 1720 trip to Hamburg Bach is believed to have met Reincken, whose music he had known since his teens.

The Fantasia may have been composed separately during Bach's time in Köthen (1717–23).

No autograph manuscript of either the Fantasia or the Fugue survives, and no manuscript of the Fantasia survives from the composer's lifetime. It is not clear whether the practice of coupling the Fantasia with the Fugue derives from the composer himself. William H. Bates writes: "Only one eighteenth-century manuscript in its original state [...] places the two pieces side by side. Further, it is evident that the fugue circulated widely [in manuscript] without the fantasy [...]. In fact, known or likely fugue copies by Bach pupils or associates [...] are devoid of any association with the fantasy."

There are many variant textual readings in the manuscripts, perhaps most prominently in the final chord of the Fantasia, which is recorded as both G major and G minor. Some manuscripts preserve the fugue in the key of F minor rather than G minor; this transposition was probably performed in order to make the fugue playable on an organ whose pedals lacked a high D, and may well have been approved or even carried out by the composer himself.

Arrangements
The work was transcribed for piano by Franz Liszt as S.463. Modern arrangers have orchestrated the work, such as Dimitri Mitropoulos, and Karl Munchinger.