A gang of criminals rob a Gotham City mob bank, murdering each other for a higher share of the money until only the Joker remains, who escapes with the money. Batman, District Attorney Harvey Dent and Lieutenant James Gordon form an alliance to rid Gotham City of organized crime. Bruce Wayne believes that with Dent as Gotham's protector, he can retire from being Batman and lead a normal life with Rachel Dawes – even though she and Dent are dating.
Mob bosses Sal Maroni, Gambol, and the Chechen hold a video conference with their corrupt accountant, Lau, who has taken their funds for safekeeping and fled to Hong Kong. The Joker interrupts the meeting to warn them that since Batman is unhindered by the law, he would find Lau, who would give up the mob's money for a plea bargain. Joker offers to kill Batman in exchange for half of their money. The mob bosses disagree, and Gambol places a bounty on the Joker. The Joker finds and kills Gambol, taking over his gang. The mob decides to take the Joker up on his offer.
Batman finds Lau in Hong Kong and brings him back to Gotham to testify, allowing Dent to apprehend the entire mob. The Joker threatens to kill people unless Batman reveals his identity, and starts by murdering Police Commissioner Gillian B. Loeb and the judge presiding over the mob trial. The Joker also tries to kill Mayor Anthony Garcia, but Gordon sacrifices himself to stop the assassination. Dent kidnaps one of Joker's henchmen and threatens him with a seemingly deadly game of heads or tails until Batman intervenes, warning Dent that all the criminals he has convicted would be released if anyone found out. Dent learns that Rachel is Joker's next target.
Bruce decides to reveal his secret identity to prevent more deaths. Before he can, however, Dent falsely announces that he is Batman to lure the Joker out. Dent is taken into protective custody, but the Joker appears and attacks the convoy. Batman comes to Dent's rescue and Gordon, who faked his death, apprehends the Joker, securing a promotion to Commissioner. Rachel and Dent are escorted away by detectives on Maroni's payroll; Gordon later learns that they never arrived home. Batman interrogates the Joker, who reveals that they have been trapped in separate locations rigged with explosives and that Batman must choose one to save. Batman races to save Rachel, while Gordon attempts to rescue Dent. Batman arrives at the building, but realizes that the Joker has sent him to Dent's location instead. Both buildings explode, killing Rachel and disfiguring Dent. The Joker escapes with Lau, who leads him to the Mob's funds. The Joker burns his share of the money and kills Lau and the Chechen.
Coleman Reese, an accountant at Wayne Enterprises, deduces that Bruce is Batman and threatens to publicize the information. Not wanting Reese's revelation to interfere with his plans, the Joker threatens to destroy a hospital unless Reese is killed within an hour. All hospitals are evacuated and Gordon travels to secure Reese. The Joker, disguised as a hospital nurse, discovers Dent's ward and hands him a gun, convincing him to seek revenge for Rachel's death. The Joker destroys the hospital and escapes with a busload of hostages. Dent goes on a killing spree, deciding the fates of people he holds responsible for Rachel's death by flipping his lucky coin, one face of which was corroded in the explosion. Dent eventually apprehends Gordon's family, believing Gordon's love for his family parallels his love for Rachel.
After announcing that Gotham City will be subject to his rule by nightfall, the Joker rigs two evacuating ferries with explosives; one carrying civilians and the other prisoners. The passengers have been supplied with a trigger to the other boat's explosives, and the Joker announces through an intercom that he will blow both ferries if one of them has not been destroyed by midnight. Batman finds the Joker by using a sonar device that spies on the entire city, with the reluctant help of Lucius Fox. The civilians and the prisoners refuse to kill each other, while Batman apprehends the Joker after a fight. Before the police arrive to take the Joker into custody, he gloats that Gotham's citizens will lose hope once Dent's rampage becomes public knowledge.
Gordon and Batman arrive at the building where Rachel died and find Dent threatening to kill Gordon's family. Dent again flips his coin and shoots Batman, spares himself, and aims to kill Gordon's son, claiming that Gordon's negligence is responsible for Rachel's death. Batman, who was wearing body armor, tackles Dent off the building to his death. Batman persuades Gordon to let him take responsibility for the killing spree to preserve Dent's heroic image. As the police launch a manhunt for Batman, Gordon destroys the Bat-signal, Fox watches as the sonar device self-destructs, and Alfred burns a letter from Rachel saying she plans to marry Dent.