• WARNING: Spoilers

    In the near future, humanity is preparing to launch an attack on the homeworld of an alien race called the Formics who had attacked Earth and killed millions; the Formic invasion was stopped by Mazer Rackham, who crashed his F-35 Lightning II into a Formic queen ship at the apparent cost of his life. Over the course of 50 years, gifted children are trained by the International Fleet to become commanders of a new fleet for this counter-attack.

    12-year-old Cadet Andrew "Ender" Wiggin (Asa Butterfield) draws the attention of Colonel Hyrum Graff (Harrison Ford) and Major Gwen Anderson (Viola Davis) by his aptitude in simulated space combat. They order the removal of his monitor, signifying the end of the cadet program. Ender is attacked by Stilson, a bully student he defeated in the combat sim, but Ender fights back and severely injures him. Ender confesses his grief to his older sister Valentine, but is harassed further by their older brother Peter. That evening while the family is having dinner, Graff arrives to reveal he was being tested and is still part of the program. Graff brings Ender to Battle School, an orbiting space station in Earth's orbit, placing Ender with other cadets his age, but treats him as extraordinary, ostracizing him from the others.

    Among other studies, the cadets are placed in squads and perform training games in a zero gravity "Battle Room". Ender quickly adapts to the games, devising new strategies older students have not yet seen. Graff reassigns Ender to Salamander Army, led by Commander Bonzo Madrid, a short, bitter, but intimidating squad leader. Bonzo, believing that Ender is inept due to his size, prevents him from training with the rest of the squad. Another cadet, Petra Arkanian, takes Ender and trains him privately. While Bonzo is aware of this, he does not take any action against Petra. In one match, Bonzo orders Ender to stay behind while the rest of the Salamander Army fights another team; however, seeing Petra in trouble, Ender comes to her aid and helps the Salamander Army win. After the match, Bonzo is humiliated by the other students and threatens Ender if he embarrasses him again.

    Meanwhile, Ender plays a computerized "mind game" set in a fantasy world aimed to present difficult choices to the player. In one situation, Ender creates an outside the box solution to overcome a seemingly unsolvable problem. Later, he encounters a Formic in the game, and then a simulated image of Valentine entering the ruins of a castle. Inside, he finds another image of Valentine but as he nears, it turns into an image of Peter before the game ends.

    Graff promotes Ender to his own squad, made from other students that have gained Ender's trust. They are put in increasingly difficult battles. In one match against two other teams including Bonzo's squad, Ender devises a novel strategy of sacrificing part of his team to achieve a goal, impressing Graff. Bonzo accosts Ender in the bathroom after the match, but Ender fights back and Bonzo falls during the struggle, seriously injured. Distraught over this, Ender prepares to quit Battle School, but Graff has Valentine speak to him and convince him to continue.

    Graff takes Ender to humanity's forward base on a former Formic planet near their homeworld. There, Ender meets Rackham, who explains how he spotted the shared-mind nature of the Formics to stop the attack fifty years prior. Ender finds that his former squad members are also here to help him train in computerized simulations of large fleet combat; Rackham puts special emphasis on the fleet's Molecular Detachment (MD) Device that is capable of disintegrating matter. Ender's training is rigorous and Anderson expresses concern they are pushing Ender too fast, but Graff notes they have run out of time to replace Ender.

    Ender's final test is monitored by several of the fleet commanders. As the simulation starts, Ender finds his fleet over the Formic homeworld and vastly outnumbered. He orders most of his fleet to sacrifice themselves to protect the MD long enough to fire on the homeworld. The resulting chain reaction burns over the surface of the planet, killing the entire population. The simulation ends, and Ender believes the test is over, but the commanders restart the video screens, showing that the destruction of the Formic homeworld was real and Ender had been controlling the real fleet this time. Despite Graff's assurance he will be known as a hero, Ender is furious as he feels responsible for the annihilation and that everyone will remember him as a killer.

    As Ender struggles with his emotions, he recognizes one of the Formic structures nearby similar to the ruined castle from the game, and believing they were trying to communicate with him, races out towards it. He follows the path set by the game, and encounters a dying Formic queen. The Queen acknowledges Ender's role in the genocide of their race, but that he simply wanted peace in the long term and forgives him. The Queen later gives Ender a queen egg that it had been protecting.

    After the war, Ender is promoted to Admiral, given a small ship, and left to his own devices. In a letter to Valentine, he tells her that he is going into deep space, determined to form a new Formic colony with the queen egg.