In Gotham City, the Joker robs a mob-owned bank with his accomplices, whom he tricks into killing each other before killing the last one himself. That night, a trio of Batman impersonators interrupts a meeting between mobsters and the Scarecrow. The real Batman appears and apprehends all of the criminals and impostors, but suffers injuries from dog bites, leading him to re-design his batsuit. Batman and Lieutenant James Gordon contemplate including new district attorney Harvey Dent in their plan to eradicate the mob, as he could be the public hero Batman cannot be. Bruce Wayne runs in to Rachel Dawes and Dent, who are dating, and after talking to Dent he chooses to host a fundraiser for him.
When mob bosses meet to discuss Batman, Gordon, and Dent, a Chinese mobster accountant, Lau, informs the gang leaders he has hidden their money to pre-empt a plan Gordon has hatched to seize the mobsters' funds. He also informs them that one of their deposits, worth $68 million, was stolen by the Joker. The Joker arrives unexpectedly, offering to kill Batman in return for half of the mob's money, but the offer is refused. After Batman abducts Lau in Hong Kong and delivers him to the Gotham City police, the mobsters agree to hire the Joker. The Joker tells Gotham that if Batman does not turn himself in to police and publicly reveal his identity, people will die each day. When Commissioner Gillian B. Loeb and the judge presiding over the mob trials are murdered, Wayne decides to reveal his identity. Before he can, Dent announces that he himself is Batman and is arrested as part of a plan to draw the Joker out of hiding. The Joker attempts to ambush the police convoy carrying Dent, but Batman and Gordon intervene and arrest him; in recognition of his actions, Gordon is appointed police commissioner.
Later that night, when Dent and Rachel disappear, Batman interrogates the Joker at the police station, who reveals that they have been captured by corrupt police and placed in warehouses rigged with explosives on opposite sides of the city; they are far enough apart that Batman cannot save them both. Batman leaves to save Rachel, while Gordon and the police head after Dent. With the help of a bomb planted at the police station, the Joker escapes with Lau. Having been deceived by the Joker, who gave him reversed addresses, Batman arrives at Dent's location in time to save him, but the left side of Dent's face is burned in the resulting explosion. Gordon does not arrive in time to save Rachel and she perishes. In the hospital, Dent is driven to madness over the loss of Rachel. After burning Lau with his half of the mob's money, the Joker goes to the hospital and convinces Dent to exact revenge on the corrupt cops and mobsters responsible for Rachel's death, as well as Batman and Gordon.
Dent goes on a personal vendetta confronting the cops and mobsters one by one, deciding their fates with the flip of a coin. The Joker announces to the public that anyone left in Gotham at nightfall will be subject to his rule. With the bridges and tunnels out of the city closed due to a bomb threat by the Joker, authorities begin evacuating people by ferry. The Joker places explosives on two of the ferries—one ferry with convicts, the other with civilians—telling the passengers the only way to save themselves is to trigger the explosives on the other ferry; otherwise, he will destroy both at midnight.
Batman locates the Joker and prevents him from destroying the ferries after the passengers on both decide not to destroy each other. The Joker acknowledges that Batman is truly incorruptible, but that Dent was not, and his madness has been unleashed upon the city. Subduing the Joker and leaving him for the SWAT team, Batman leaves in search of Dent. At the remains of the building where Rachel died, Batman finds Dent holding Gordon and his family at gunpoint. Dent judges the innocence of Batman, himself, and Gordon's son through coin tosses. He shoots Batman in the abdomen, but he is wearing body armor. Before Dent can determine the boy's fate, Batman tackles him, and they both fall over the side of the building – Dent appears dead. Batman and Gordon realize that the morale of the city would suffer if Dent's murders would become known. Batman persuades Gordon to preserve Dent's image by holding Batman himself responsible for the murders. Gordon destroys the Bat-Signal, and a manhunt for Batman ensues.