There’s not a single way to nutmeg a defender. The easiest one is with the help of the weaker foot. While you are dribbling the ball with your right foot, keep moving towards your right and just when the defender is about to tackle you, use your left foot to guide the ball straight. You will notice that the defender will never expect the ball to go straight since you used your weaker foot, and it will pass through his/her legs. Simply outrun the defender in order to get the ball back. The best way to outrun your opponent is by putting your body in between the ball and him/her.
Another easy way to nutmeg a defender is through the drag back trick. The Argentinean star, Lionel Messi, has managed to master this skill. Simply stop before dribbling past a defender. As soon as he/she is about to pounce on you, drag the ball back with your stronger foot and knock it forward. The defender’s legs will open up when you drag the ball back, and as soon as you knock the ball forward, it will pass through his/her legs.
This third way to nutmeg a defender is situational. This is while you are shielding the ball. For instance, if you have been cornered by a defender and you are shielding the ball from him/her, simply keep shielding the ball until you see a space between his/her legs, which eventually does open up while trying to snatch the ball away from you. In this case, simply give the defender a little push from your shoulder; use the flat side of your foot to perform a back flick and you will notice how the ball will easily pass through his/her legs. It seems difficult to perform this nutmeg, but most defenders fall for the trap which you set up while shielding the ball.