The Magic Flute (German: Die Zauberflöte, K. 620) is an opera in two acts with music by Wolfgang Amadeus Mozart and a German libretto by Emanuel Schikaneder.

It premiered in Vienna on 30 September 1791 at Schikaneder's theater, the Freihaus-Theater auf der Wieden. The story has traditional fairy tale themes and Masonic elements.

Prince Tamino has got lost in the forest and now finds himself in a country which is ruled by the Queen of the Night. A huge monster chases him and he is very frightened. He falls down in a faint. Three ladies who work for the Queen of the Night come and kill the monster. Then they see the handsome prince and they argue about which one of them will stay to look after him.

The three ladies go off and Papageno enters. Papageno is a birdcatcher whose job is to catch birds for the Queen of the Night. He is a happy, simple young man. Tamino wakes up, sees him and asks him who he is. Papageno introduces himself. He has not noticed the dead monster. Tamino sees that the monster is dead and asks him who killed it. Papageno suddenly notices it and then decides to pretend that he killed it himself. The three ladies hear what he says and they come and punish him by giving him a stone instead of bread and wine, and by padlocking his mouth so that he cannot speak. Then they give Tamino a portrait of Princess Pamina. She is the daughter of the Queen of the Night. They tell him that Pamina has been captured by an evil man called Sarastro. In fact, Sarastro is a good man, and he is looking after Pamina because her mother, the Queen of the Night, is evil. The prince does not know this. He is already in love with the princess just from looking at her picture, and decides to go and rescue her.

The three ladies give the Prince a magic flute which will protect him if he finds himself in danger.  They promise Papageno that he, too, will find a lovely wife for himself if he goes with Tamino.  They take off his padlock and give him a set of magic bells which will help him if he is in danger.  They are told that three lovely boys will show them the way.

In the next scene we see Princess Pamina who is being guarded by a cruel Moor called Monostatos.  He has tied the princess up.  Papageno arrives and both men are frightened of one another.  Monostatos runs away, Papageno unties the rope around the princess and tells her about the prince who is on his way to rescue her.

In the next scene Tamino finds himself in a holy place.  The three boys have guided him there.  They tell him he must be patient and silent.  He meets a priest who tells him he must not think that Sarastro is cruel.  He tells him that Pamina is alive.  Tamino is very happy to hear this, takes his flute and plays.  The animals from the forest come round him.  Pamina and Papagena are caught by Monostatos.  He is about to tie them up, but Papageno plays his magic bells and, when they hear the music, Monostatos and all the animals cannot help dancing and they disappear, still dancing.  Sarastro enters.  He tells Pamina once more that she must stay with him to learn how to live a good, virtuous  life.  She must not become evil like her mother.  Monostatos enters with Tamino whom he has caught.  Tamino and Pamina see one another and embrace.  Sarastro says that Monostatos must have a beating.  He says that Tamino and Pamina cannot have one another yet.  First they will have to go to the temple and go through some trials to show that they are good.

Sarastro explains to the priests that Tamino and Pamina will have to go through the trials to show that they are worthy of one another.  If they can do this then they will be able to defeat the evil power of the Queen of the Night.

Tamino and Papageno go through the trials together.  Tamino remains calm and brave.  Papageno is frightened and finds it difficult to keep quiet, but he continues because he has been promised that a girl called Papagena will be waiting for him.

In the first trial the Three Ladies try to make them think that the dark place they are in will lead them to death.  In the second trial they see Monostatos about to rape Pamina.  The Queen of the Night explains why she wants power.  She says that Tamino and Pamina will be cursed unless Sarastro is killed.  Tamino realizes that this is all part of the trial and he must not do anything.  Papageno is given food and drink by Papagena who is disguised as an old lady.  Tamino plays his flute.  Pamina appears but turns her back on him. The Queen of the Night sings a very famous song in this section. It is famous because it reaches the highest ranges of a female voice.

Tamino and Pamina have to go through the last trial together.  Papagena enters and dances, then, when Papageno promises to be true, she throws off her disguise and disappears.  Pamina thinks her mother is going to use her dagger, but at the last moment the boys save her and take her to Tamino.  Tamino plays the flute as they go together through fire and water.  The chorus sing in triumph.

Papageno cannot call Papagena back with his shepherd pipe.  The three boys remind him about his magic bells.  He plays them and Papagena appears.  They are united.

In the last scene Monostatos and the Queen of the Night enter to do battle, but they are defeated.  Good triumphs over evil.

Mozart belonged to a group of Freemasons.  The Magic Flute is full of Masonic symbols.  For example: the number three is an important number in masonry and there are lot of things in the opera that happen in threes:  there are three long chords at the beginning of overture, and the three chords appear again in the scene in the temple.  Even the key is E flat major which has a key signature of three flats.  There are three ladies, three young boys and three trials.  The scenery used in the early productions make it look as if the story comes from Egypt or somewhere in the Orient.  Mozart and Schickaneder meant this to have a Masonic meaning. The trials are similar to the rituals in Masonic ceremonies.