The megaflip lets you greatly extend the length of your backflip or sidehop by getting hit by a damage source on a frog frame.
The megaflip is similar to the recoil flip. In fact, they get exactly the same distance. However, since recoil flips become hovers when Link has ISG, megaflips can still be used with ISG, allowing you to get much more distance per explosive than with standard backflip hovering.
See general notes below regarding crash risks.
If you roll on the first HESS frame, then the 2 frog frames line up with the first 2 frames of the bomb explosion, meaning inputting a backflip on either of the 2 frames will yield a megaflip.
If you roll on the second HESS frame, then the first bomb explosion frame will be on the frame before Link can begin a backflip. This means that the backflip must be input on the first frog frame, which aligns with the second bomb explosion frame. A backflip on the second frog frame will be too late in the bomb explosion and will just be a normal backflip.
If you roll on the frame before the HESS frames, then the first bomb explosion frame will be on the second frog frame. Backflipping on this frame would yield a megaflip, but because Link is inside the explosion radius, the bomb would hit him and knock him out of the megaflip on the very next frame when he runs out of i-frames, so rolling on this frame is not useful.
If the control stick is not below neutral starting the frame after the backflip is input, a megaflip starts at 17.95 speed backwards and decreases by 0.05 speed every frame. Holding up on the control stick does not affect a megaflip's speed, and holding right or left will bend the megaflip in the opposite direction (e.g. holding right bends the trajectory leftward).
If the control stick is below neutral on any frames after the backflip is input, a megaflip has a significantly lower starting speed and decreases speed at a faster rate for every additional frame down is held. Holding the down notch for one extra frame beyond the backflip yields a starting speed of only 14.
Megaflips on the ground can crash on both JP and English. This can be prevented by moving the control stick to up right after the backflip or by holding shield when inputting the backflip.
If you roll on the first HESS frame, then the 2 frog frames line up with the first 2 frames of the bomb explosion, meaning inputting a backflip on either of the 2 frames will yield a megaflip.
If you roll on the second HESS frame, then the first bomb explosion frame will be on the frame before Link can begin a backflip. This means that the backflip must be input on the first frog frame, which aligns with the second bomb explosion frame. A backflip on the second frog frame will be too late in the bomb explosion and will just be a normal backflip.
If you roll on the frame before the HESS frames, then the first bomb explosion frame will be on the second frog frame. Unlike for a megaflip on the ground, backflipping on this frame will yield a megaflip because Link is high enough above the explosion radius that the megaflip takes him out of the explosion radius altogether. However, as the first frog frame is before the bomb explodes, backflipping on that frame will cause Link to take damage and fall.
If the control stick is not below neutral starting the frame after the backflip is input, a megaflip starts at 17.95 speed backwards and decreases by 0.05 speed every frame. Holding up on the control stick does not affect a megaflip's speed, and holding right or left will bend the megaflip in the opposite direction (e.g. holding right bends the trajectory leftward).
If the control stick is below neutral on any frames after the backflip is input, a megaflip has a significantly lower starting speed and decreases speed at a faster rate for every additional frame down is held. Holding the down notch for one extra frame beyond the backflip yields a starting speed of only 14.
Megaflips in the air can crash on English (not JP). This can be prevented by moving the control stick to up right after the backflip or by holding shield when inputting the backflip.
Megasidehops have the same input frame data as megaflips on the ground even in the air; rolling on the frame before the HESS frames is not useful. This is because megasidehops do not gain nearly as much height as megaflips, since normal sidehops don't go as high as normal backflips. However, megasidehops are easier to control because holding right or left for additional frames after beginning the megasidehop does not reduce the backward speed like holding down after inputting a megaflip does.
It's not uncommon to encounter an A-Slide crash if you slightly mistime the inputs for a megaflip/megasidehop. To avoid crashing, hold R during the backflip/sidehop inputs and/or flick the control stick from down to up after backflip inputs. This crash can occur while Link is on the ground on both English and JP, but it can only occur in the air (during a hover) on English. Megaflipping/megasidehopping on JP from a hover has no likely crash risk.
If you are attempting a megaflip and recognize that you've rolled on a bad frame before the bomb explodes, do not attempt the megaflip, and instead hold shield to prevent the bomb from knocking Link down so you can try again.
These diagrams by Malagutti compare how much distance megaflips, megasidehops, and hold backflips get.
Like almost every trick in the game, megaflips can be pause buffered. This video shows the frames you're looking for; in all scenarios, shield drop and roll (buffer R and A) on the shown frame, then buffer either a sidehop or a backflip (buffer A while holding left/right/down) on the given frame. Make sure you only advance one frame after that, though, so you can let go.
This document is another good resource for learning how to do a megaflip, but is mostly redundant in combination with this page.