The Speaker of the House is behind the coup because he is against the President's new peace treaty. After the coup fails, he is arrested for treason. Agent Walker was involved because his son was killed in a mission the President authorized. He is killed by John Cale with the minigun on the Presidential SUV. The President then orders Cale to be a part of his Secret Service detail.
Former U.S. Army soldier John Cale (Channing Tatum) is a Capitol police officer assigned to protect Speaker of the House Eli Raphelson (Richard Jenkins). He got the assignment because he saved the life of Raphelson's nephew while they were both in Afghanistan. Bored with the job, he applies to join the Secret Service, but the interview, conducted by a former college acquaintance Carol Finnerty (Maggie Gyllenhaal), doesn't go well. Cale's daughter Emily accompanied him to the White House, and after lying to her by saying the interview went well, they decide to take a tour of the White House. At the same time, President James Sawyer (Jamie Foxx) has announced a new proposed peace treaty that would remove all U.S. troops from the Middle East.
During the tour, Cale notices several men dressed as A/V installers entering the White House. Shortly after that, Emily asks to use a restroom. While she is away, a bomb is detonated at the U.S. Capitol. Raphelson is shaken up, but uninjured. Finnerty, who was driving by the Capitol when it blew up, goes in, finds the Speaker and gets him to safety at the Pentagon. She does so because he is 2nd in line of Presidential succession, after the Vice President. The VP is also taken to safety inside Air Force One, which then takes off. As a result of the explosion, the White House goes on lockdown, which separates Emily from Cale and the rest of the tour group. The A/V installers, led by Emil Stenz (Jason Clarke), then produce weapons and start to go through the White House, killing the Secret Service agents and other security.
The President is taken to the Presidential Emergency Operations Center by retiring Secret Service Detail leader Martin Walker (James Woods). But as he is about to enter it, Walker kills all of the agents inside the PEOC. Walker then tells the President that this is revenge because his son was killed in a black ops mission that he ordered. Meanwhile, Cale is able to get a weapon away from one of the terrorists and begins looking for Emily. He doesn't find her, but he does see Walker and the President. He shoots at Walker, and the President is able to get away. Cale then gets in a shootout with the terrorists, with the President hiding nearby. Cale and the President are able to get on an elevator and get away. At this time, Walker brings in Skip Tyler (Jimmi Simpson), who is hired to hack the U.S. defense systems, but he needs the President alive so he can activate the nuclear arsenal from the "football" that is used to launch nukes.
Cale and the President are able to avoid Stenz and Walker and eventually make it to the garage, where they attempt to use the Presidential limo to escape. They are in pursuit by the terrorists in the Presidential SUV, which is armed with a minigun. The chase on the South Lawn, which is broadcast on worldwide television, ends with the limo crashing into the White House swimming pool. There is then a shootout that ends with an explosion, presumably killing the President and Cale. The Vice President, still on Air Force One, takes the Oath of Office to become the new President, and he immediately orders Delta Force to retake the White House. Tyler learns of the attack and warns Stenz and the other terrorists, and they are able to defeat the Delta Force. Tyler, who also has control of NORAD, launches a missile at Air Force One, which destroys it and kills the former Vice President. Speaker Raphelson is then sworn in as the new President, and orders an air strike on the White House. Meanwhile, Cale and the President are still alive. One by one, Cale is able to kill the terrorists, and the President even kills one himself.
Stenz discovers that the man who has been protecting the President is the father of one of the hostages. He then takes Emily to Walker, who uses the White House intercom to order Cale to hand over the President or he will kill her. Before Cale can surrender, the President surrenders to Walker. Now in the Oval Office, Walker produces the nuclear football and demands that the President activate it. He refuses, and is forced to activate it, then shot. Since the President's codes were deactivated once the attack began, Walker produces his own nuclear launch codes and orders a nuclear attack against Iran, which will begin World War III. While that is happening, Stenz finds Cale and they get into a fight in the White House Press Room. Cale eventually gets the upper hand and pulls the pin on a grenade on Stenz's belt. The explosion kills him instantly. Cale then goes to the Presidential SUV and drives it into the Oval Office. Before Walker can launch the nukes, Cale shoots him with the minigun, killing him. After reuniting with Emily and telling her to run away due to the air strike, Cale goes to get the President. Instead of running, Emily takes a flag and tries to wave off the air strike. The lead pilot sees her and aborts the mission. Cale then finds the President and sees he survived the gunshot because the bullet hit a pocketwatch that he always carries with him.
At the Pentagon, everyone is cheering that the siege is over. However, Finnerty's investigation of the terrorists shows that Walker couldn't be the one who hired them for the attack. There was someone else involved, and when she calls and tells that to Cale, he figures out who it is. Later, Raphelson and Finnerty fly to the White House on Marine One, and they meet up with Cale. He tells Raphelson the President is dead, so he orders troops back into the Middle East, which is a violation of the peace treaty. Cale and Finnerty then confront Raphelson that he is the one who gave Walker the launch codes and tried to kill the President so his defense buddies could keep their jobs, and the air strike would have destroyed all the evidence that proved he was involved in the attack. President Sawyer then emerges from the rubble and orders Raphelson arrested for treason for the attempted coup.
The movie ends with the President hiring Cale to be on his personal Secret Service detail, and they, along with Emily, take a flying tour of Washington before he goes to the hospital.