From the Super Mario Wiki
Invincible Mario is a form that makes its debut in Super Mario Bros. Mario can assume the form after using a Super Star, which made its debut in the same game; while in this state, he is unaffected by most enemies and obstacles, and can defeat most of them by simply touching them. However, the state only lasts a few seconds, and Mario can still lose a life if he falls into a pit, touches lava, poison, ash, or a Boohemoth, gets crushed in any way, or runs out of time. Invincibility is usually depicted by a flashing, color-changing character. Unless he's already in another invincibility-granting form (like the Mega or White Tanooki forms, which are incompatible with this form), Mario usually retains his current form while invincible (for example, if Fire Mario gets a Super Star, he becomes invincible, but retains his Fire form).
This form is distinct from the state of invulnerability Mario gets for several seconds after taking damage in most games.
Super Mario series
Super Mario Bros. / Super Mario Bros.: The Lost Levels
Super Mario Bros. 2
In Super Mario Bros. 2, Super Stars, and thus invincibility, are gained by grabbing five Cherries. Because enemies respawn off-screen and hearts spawn for every eight foes defeated (except in Super Mario Advance, where hearts spawn differently, enemies only respawn upon returning to an area, and a traditional Super Mario World-style point system is added), this form is mainly used to recover health.
Super Mario Bros. 3
As of Super Mario Bros. 3, Mario somersaults when he jumps in this form, in a similar fashion to Samus Aran. Also, there are some ? Blocks that normally contain coins, but instead contain Super Stars if Mario or Luigi is invincible when they strike the block. This allows the player to string together a long period of invincibility, and thus gain even more points (and in Super Mario Advance 4: Super Mario Bros. 3, extra lives).
Super Mario Land
Super Mario Land features the same invincibility as in Super Mario Bros.
Super Mario World
Starting with Super Mario World, Invincible Mario starts earning extra lives from the eighth enemy defeated onwards (which also gives an increasing point reward up to that point). This property was also included in the Game Boy Advance remakes of Super Mario Bros. 2 and Super Mario Bros. 3, which originally did not have it.
Super Mario Land 2: 6 Golden Coins
In Super Mario Land 2: 6 Golden Coins, Mario starts earning extra lives from the fifth enemy defeated onwards, rather than the eighth.
Super Mario 64
New Super Mario Bros. series
In the New Super Mario Bros. series, Invincible Mario returns, working as it did in Super Mario World. In addition to making players invincible, it also increases one's running speed in New Super Mario Bros., and it can be shared in New Super Mario Bros. Wii, New Super Mario Bros. U, and New Super Luigi U if an invincible player lifts a vulnerable partner (or vice-versa). The latter three games also give Mario the ability to defeat Enemy Courses on the map without entering them, though he won't get any items from them.
New Super Mario Bros. also features Mega Mario, which is similarly invincible.
New Super Mario Bros. 2, in addition to bringing back the Mega form, also introduces White Raccoon Mario (gained just like the White Tanooki form from Super Mario 3D Land), which gives permanent invincibility for the level in addition to Raccoon Mario's abilities, the ability to walk on water (like Mini Mario), and a faster-charging Power Meter. If White Raccoon Mario uses a Super Star, this form's invincibility will override its own until it wears off.
Super Mario Galaxy / Super Mario Galaxy 2
In Super Mario Galaxy and Super Mario Galaxy 2, there is a similar form known as Rainbow Mario that can be obtained by using a Rainbow Star. Unlike the Invincible form, the Rainbow form speeds up until it expires and can break through objects, but it cannot give Mario extra lives, nor can it be combined with any other form.
Super Mario 3D Land
In Super Mario 3D Land, Invincible Mario makes its 3D Super Mario debut. As in Super Mario Land 2, Mario must only defeat five enemies to start gaining extra lives, rather than the usual eight. Unlike in most games, Mario merely glows golden while invincible in this game.
Also, White Tanooki Mario debuts in this game, becoming available by an Invincibility Leaf after dying five times in a row on a (skipped) normal world course. In addition to Tanooki Mario's abilities, it makes Mario permanently invincible for the level, though he cannot gain extra lives by defeating enemies.
Super Mario 3D World
In Super Mario 3D World, invincibility works as it did in the New Super Mario Bros. games, with the only differences being that an extra life is gained for every eighth enemy defeated (instead of every enemy from the eighth onwards), and invincible players merely need to touch others to share the invincibility, rather than grab them. The new Lucky Bell lets Mario turn into an invincible lucky cat statue for a brief time. The Mega and White Tanooki forms also return.
Super Mario Run
In Super Mario Run, the Super Star once again grants invincibility. It also makes characters run faster, activates Coin Rush mode in Toad Rally, and attracts nearby coins (except Black Coins) to the player.
Super Mario Odyssey
Mario Kart series
In the Mario Kart series, every driver can become invincible by touching and/or using a Super Star, allowing them to drive faster and make other drivers spin-out or tumble by touching them, unless both drivers are invincible, in which they bump each other normally. In Mario Kart Tour, a Frenzy will make the driver invincible. The Star Thwomps of the original Rainbow Road are also invincible, causing the same effects to any driver that runs into them.
Appearances in other games
In Donkey Kong Country 2: Diddy's Kong Quest, Donkey Kong Country 3: Dixie Kong's Double Trouble!, & Donkey Kong Land 2, the Kongs can become invincible by breaking through an Invincibility Barrel. While invincible, they gain the same effects as a Super Star, such as flashing and defeating enemies with a mere touch. They also still lose a life if they fall in a pit, even when invincible.
In Mario & Luigi: Bowser's Inside Story and Mario & Luigi: Bowser's Inside Story + Bowser Jr.'s Journey, in one of Bowser Memory M's moves, he uses a Super Star to become invincible and attack the Mario Bros., complete with the theme music and the effect of knocking a hit bro off-screen for the move's duration.
Invincible Mario makes a small appearance in Mario Golf: World Tour and Mario Sports Superstars as a post-hole animation, specifically when either Mario or Gold Mario/Metal Mario receives an Eagle or better.
Super Mario World 2: Yoshi's Island, its remake, and Yoshi's Island DS allow Baby Mario become invincible by grabbing a Super Star; he becomes Superstar Mario, and is also able to glide with a cape, run up walls, and run faster than the Yoshis. Yoshi's New Island instead features the Yoshi Star, which turns the Yoshis themselves into Super Yoshis, which gives the Super Star's abilities (bar the cape glide).
Yoshi's Story features the Super Happy form, gained by eating a Heart Fruit or collecting six melons from a minigame. In this form, not only are the Yoshis briefly invincible, they also gain super strength (including improved ground pounds), a longer tongue, a better Flutter Jump, and an infinite supply of eggs for the form's duration.
In Yoshi's Woolly World, once Yoshi touches an Invincibility Egg (which spawns after five deaths), he glows orange and be immune to damage from enemies and their attacks. However, Yoshi cannot instantly defeat enemies by touching them, and he can still be pushed by enemies, and instantly defeated by spike pits, bottomless pits, lava, and being crushed.
Appearances in other media
In The Super Mario Bros. Super Show!, neither Invincible Mario or Luigi ever made an appearance, as a Starman would not turn Mario or Luigi invincible, but instead served as an alternative to the Fire Flower for becoming "Super Mario" or "Super Luigi".
In The Adventures of Super Mario Bros. 3 and Super Mario World, however, they functioned as a Starman normally does in the games, granting them invincibility for a limited time. However, in Super Mario World, Luigi is the only character to obtain a regular Starman, but Mario somehow also becomes invincible from his "dizzy stars" after getting knocked down by a T-Rex in the “Party Line” episode.
Super Mario Land
Super Mario Land 2: 6 Golden Coins
Names in other languages