The Sonata in D is the last of a group of six piano sonatas composed in Munich during the early months of 1775. Mozart was in the Bavarian city with his father Leopold and sister Nannerl for the premiere of his opera buffa La finta giardiniera, an event that delays caused to be postponed from its original date in the previous December until January 13. While the purpose behind the composition of the previous five sonatas is not known, the D major was composed to a commission by Baron Thaddäus von Dürnitz, an amateur bassoon player for whom Mozart may also have written his Duet for Bassoon and Cello, K. 292 (K. 186c).
Mozart's undated autograph manuscript numbers the six sonatas, suggesting that he may have intended to publish them as a cycle. If such an intention was on his mind, it appears to have remained unfulfilled, but letters to his father during the long trip he made to Mannheim and Paris in the company of his mother in 1777 - 1778 make it clear that he frequently played them himself. The group is referred to in family letters as schwere Sonaten, a curious description given that, with the exception of the work under consideration, they are his easiest piano sonatas. In addition to being more demanding than its five predecessors, the work is notable also for being much the longest of the sonatas Mozart had composed to date. The principal reason is the long set of variations which form the final movement, the first time Mozart had employed variation form in a piano sonata, and the only example apart from the opening movement of the Sonata in A, K. 331. Following an opening sonata form Allegro, the central movement is a Rondeau en Polonaise in which French influence is clearly apparent. Nine years after its composition, K. 284 was published in Vienna in a reworked version.