Stylus phantasticus is a genre of Baroque instrumental music originating in Italy in the early 17th century. The style, also known as the fantastic style, was first described by Athanius Kircher in his seminal music treatise Musurgia Universalis (1650):
The Fantastic style ... is the most free and unrestrained method of composing; it is bound to nothing, neither to words nor to a melodic subject; it was instituted to display genius and to teach the hidden design of harmony ... and is divided into categories commonly called Fantasias, Ricercars, Toccatas, and Sonatas.

Kircher defined the style as exclusively contrapuntal; soggetti were imitated with differing counterpoint and differing speeds. Compositions were organized "with regard to manifest invention, the hidden reason of harmony, and an ingenious, skillful connection of harmonic phrases and figures". Kircher offered the toccatas of Girolamo Frescobaldi as an example of the style.

Eighty-nine years later, the German composer and theorist Johann Mattheson updated the definition in his work of musicology Der volkommene Capellmeister (1739), calling it "the most free and unrestrained manner of composing and singing that one can imagine." Although his new definition made use of Kircher's formulation, Mattheson identified improvisatory compositional license and interpretational freedom as the stye's key elements. According to Mattheson, the intended effect of stylus phantasticus was to overwhelm and astonish.

The stylus phantasticus arose from the desire to instrumentally imitate the vocal expression and drama of early opera, and may have roots in melismatic chant. The style emphasized experimentation, dramatic contrast and excitement, and called for elaborate ornamentation, extravagant flourishes, and sudden shifts in tempo and tonality. Works in the style were generally short and structured sectionally, with dissonant harmonies and repeated rhythmic and chord patterns. The stylus phantasticus had a rhapsodic quality, and was intended to convey a sense of unity through diversity and flamboyance.

The unrestricted nature of the stylus phantasticus opened up new possibilities for musical expression; the style was indicative of the early Baroque shift from the convoluted, independent polyphonic voices of the Renaissance to single melody lines. The style played a key role in establishing a solo repertory for the violin, which had previously been used primarily as an accompanying instrument for dance music. The violin's range of expression, virtuoso flexibility and imitative qualities made it ideally suited to the stylus phantasticus.

The stylus phantasticus reached its pinnacle in the 17th century composers of the Italian and German-Austrian-Bohemian schools. Arcangelo Corelli is the most famous composer whose work includes stylus phantasticus elements. Notable exponents of the style include Pandolfi, Uccellini, Marini, Buxtehude, Schmelzer, Walther, and Biber.