Ender Wiggin, the third in a family of child geniuses, is selected by international military forces to save the world from destruction. Before being chosen Ender wears a unique monitor that allows the heads of the military to see things as Ender does. Ender's brother Peter and his sister Valentine also wore this monitor, although neither was selected, nor did they have it for as long as Ender, and Peter will never forgive Ender for this. Peter hates Ender, and even when the monitor is taken out it does nothing to decrease Peter's anger. The same is true of Ender's schoolmates, and he is forced into brutally beating the leader of a gang of bullies in order to protect himself. Although Valentine tries to protect Ender from Peter, he is only saved from his brother when Colonel Graff of the International Fleet comes to take Ender away to Battle School. Ender leaves behind Valentine, who loves him, in order to help save the world from the buggers.
Battle School is located on a ship far from earth. On the flight there Ender demonstrates his ability to brilliantly visualize gravitational effects, and Graff begins to isolate him from his fellow classmates. Ender lives with the new recruits, called Launchies. He makes a few friends among the recruits and ends his isolation, although his brilliance will never cease causing resentment. Inside the battleroom, Ender figures out how to maneuver in null gravity, along with another recruit named Alai. Ender and Alai become friends, and this helps Ender fit in with the rest of the group. Ender manages to get farther in one of the computer games, called the mind game, than anyone ever had before him, and although he does not know, the military commanders take notice.
Ender is abruptly promoted to Salamander Army. There Ender is befriended by Petra Arkanian, the only girl in the army. The army commander, Bonzo Madrid, does not like Ender and does not want him around. Ender practices with Petra and begins to teach his launch group what he knows. Ender helps the army by disobeying Bonzo, who hates Ender, but fortunately Ender is traded to Rat Army. Ender is put in Dink Meeker's platoon. Dink is an excellent toon leader, and Ender does well in battles. He continues teaching his Launchies, even though this causes resentment among other soldiers. Ender gets into a fight and he hurts four older boys who attack him. It is clear to Ender that the teachers are leaving him to fend for himself.
Meanwhile, Peter has convinced Valentine that it is time for them to assert themselves. Peter has unlimited ambition, and he is intelligent enough to try to manipulate world events. Valentine agrees to work with him because she wants their impact to be a positive one. Disguised on the information networks they soon begin to exert an influence. By this time Ender is nine years old and a platoon leader in Phoenix Army under Petra's command. Everyone respects his brilliance and his practice sessions are attended by many, but he is depressed and is stuck in the mind game. Colonel Graff comes to visit Valentine and has her write Ender a letter. The memory of Valentine helps Ender to ground himself, and he is able to continue on in the mind game, which is a great relief to his teachers.
Ender is made commander of Dragon Army and given a group of soldiers, most of them Launchies. The smallest one, Bean, is very bright and precocious, much like Ender was, and Bean proves his mettle in practice sessions. Ender's army is given an unprecedented number of battles to face, with advantages given to the enemies, and he wins every one. Each toon of his army acts as an independent unit, and this revolutionizes battleroom strategy. Bonzo is humiliated when Ender beats him. Bonzo attacks Ender in the shower room and Ender beats him, brutally, because he was forced to. Ender is then transferred out of Battle School to Command School.
The authorities figured out Valentine and Peter's actions but have decided to leave them alone. Valentine visits Ender while he is given a brief vacation, and it is clear that things have changed between them. Graff takes Ender to Eros, the planet that holds the International Fleet command, and there Ender is introduced to Mazer Rackham, the hero of the second bugger invasion, who saved mankind. Rackham runs Ender through a series of simulated battles, where he now commands an entire fleet. Ender learns that the buggers are like highly evolved insects and they communicate instantaneously—their queen thinks for all of them. Ender begins having strange dreams about the buggers. He fights more and more difficult battles and one day fights a huge battle against impossible odds with many officers watching. Ender wins, at great cost, and it becomes apparent that it was a real battle, as were all of his supposedly simulated battles, and that he completely destroyed the buggers. Ender was used, and he knows it, as do his teachers, but they explain that they needed him, a child, to have the compassion to understand the enemy. At the same time they needed him to think it was a game in order to be able to win with such great loss of life.
Peter has taken over control of the world and Valentine convinces Ender to set off with her on a colonization mission to populate the worlds left behind by the buggers. Before he goes Ender learns that he did killed Bonzo as well as the bully back in school. On the new planet Ender finds an area that he realizes looks just like the mind game and he realizes that the buggers had prepared for his coming—they had looked into his mind and knew he would defeat them. He finds a queen pupa, left behind for him to find a place for the buggers to live again. Ender can think to the queen, and sees that the buggers did not truly wish to fight the humans and feels their sorrow for all that happens. Ender decides to make it his mission to find a place for the buggers to live.