From the Super Mario Wiki
A Shrinking Potion is a yellow concoction that is capable of shrinking almost anything it touches down to a minuscule size. In order to work, its target must be doused in it, as a few mere drops are not enough to have any effect. It is unknown if the effects of Shrinking Potion are permanent, although they can be countered with something such as Growing Potion. Waldo the Wizard is apparently the inventor of Shrinking Potion, as he is capable of conjuring up a flask with little effort.
Shrinking Potion makes its first and only appearance in The Super Mario Bros. Super Show! episode "Princess, I Shrunk the Mario Brothers". When Mario, Luigi, Princess Toadstool, and Toad are sentenced to the dungeon of Waldo's castle by Mouser and two Koopa Troopas, Waldo reveals himself and douses the villains with Shrinking Potion. Once they shrink, Waldo places them in a fishbowl and announces that he will use his Shrinking Potion to vanquish King Koopa once and for all.
Hoping to shrink King Koopa himself, Toad takes the Shrinking Potion from Waldo and runs out of the dungeon with it. While attempting to splash King Koopa with the Shrinking Potion, Toad accidentally hits Mario and Luigi with it, shrinking them instead. Although Mario and Luigi get into several misadventures while they are small, they are eventually restored to their normal sizes when King Koopa mistakenly sprays them with Waldo's Growing Potion.