Bassanio, a young Venetian of noble rank, wishes to woo the beautiful and wealthy heiress Portia of Belmont. Having squandered his estate, he needs 3,000 ducats to subsidise his expenditures as a suitor. Bassanio approaches his friend Antonio, a wealthy merchant of Venice who has previously and repeatedly bailed him out. Antonio agrees, but since he is cash-poor – his ships and merchandise are busy at sea – he promises to cover a bond if Bassanio can find a lender, so Bassanio turns to the Jewish moneylender Shylock and names Antonio as the loan's guarantor.
Antonio has already antagonized Shylock through his outspoken antisemitism, and because Antonio's habit of lending money without interest forces Shylock to charge lower rates. Shylock is at first reluctant to grant the loan, citing abuse he has suffered at Antonio's hand. He finally agrees to lend the sum to Antonio without interest upon one condition: if Antonio is unable to repay it at the specified date, Shylock may take a pound of Antonio's flesh. Bassanio does not want Antonio to accept such a risky condition; Antonio is surprised by what he sees as the moneylender's generosity (no "usance" – interest – is asked for), and he signs the contract. With money at hand, Bassanio leaves for Belmont with his friend Gratiano, who has asked to accompany him. Gratiano is a likeable young man, but is often flippant, overly talkative, and tactless. Bassanio warns his companion to exercise self-control, and the two leave for Belmont and Portia.
Meanwhile, in Belmont, Portia is awash with suitors. Her father left a will stipulating each of her suitors must choose correctly from one of three caskets – one each of gold, silver and lead. If he picks the right casket, he gets Portia. The first suitor, the Prince of Morocco, chooses the gold casket, interpreting its slogan, "Who chooseth me shall gain what many men desire," as referring to Portia. The second suitor, the conceited Prince of Arragon, chooses the silver casket, which proclaims, "Who chooseth me shall get as much as he deserves", as he believes he is full of merit. Both suitors leave empty-handed, having rejected the lead casket because of the baseness of its material and the uninviting nature of its slogan, "Who chooseth me must give and hazard all he hath." The last suitor is Bassanio, whom Portia wishes to succeed, having met him before. As Bassanio ponders his choice, members of Portia's household sing a song which says that "fancy" (not true love) is "engend'red in the eyes, With gazing fed.", Bassanio chooses the lead casket and wins Portia's hand.
At Venice, Antonio's ships are reported lost at sea so the merchant cannot repay the bond. Shylock has become more determined to exact revenge from Christians because his daughter Jessica eloped with the Christian Lorenzo and converted. She took a substantial amount of Shylock's wealth with her, as well as a turquoise ring which Shylock had been given by his late wife, Leah. Shylock has Antonio brought before court.
At Belmont, Bassanio receives a letter telling him that Antonio has been unable to repay the loan from Shylock. Portia and Bassanio marry, as do Gratiano and Portia's handmaid Nerissa. Bassanio and Gratiano leave for Venice, with money from Portia, to save Antonio's life by offering the money to Shylock. Unknown to Bassanio and Gratiano, Portia sent her servant, Balthazar, to seek the counsel of Portia's cousin, Bellario, a lawyer, at Padua.
The climax of the play takes place in the court of the Duke of Venice. Shylock refuses Bassanio's offer of 6,000 ducats, twice the amount of the loan. He demands his pound of flesh from Antonio. The Duke, wishing to save Antonio but unable to nullify a contract, refers the case to a visitor. He identifies himself as Balthazar, a young male "doctor of the law", bearing a letter of recommendation to the Duke from the learned lawyer Bellario. The doctor is Portia in disguise, and the law clerk who accompanies her is Nerissa, also disguised as a man. As Balthazar, Portia repeatedly asks Shylock to show mercy in a famous speech, advising him that mercy "is twice blest: It blesseth him that gives and him that takes" (IV, i, 185). However, Shylock adamantly refuses any compensations and insists on the pound of flesh.
As the court grants Shylock his bond and Antonio prepares for Shylock's knife, Portia deftly appropriates Shylock's argument for 'specific performance.' She says that the contract allows Shylock only to remove the flesh, not the "blood", of Antonio (see quibble). Thus, if Shylock were to shed any drop of Antonio's blood, his "lands and goods" would be forfeited under Venetian laws. She tells him that he must cut precisely one pound of flesh, no more, no less; she advises him that "if the scale do turn, But in the estimation of a hair, Thou diest and all thy goods are confiscate."
Defeated, Shylock concedes to accepting Bassanio's offer of money for the defaulted bond, first his offer to pay "the bond thrice", which Portia rebuffs, telling him to take his bond, and then merely the principal, which Portia also prevents him from doing on the ground that he has already refused it "in the open court." She cites a law under which Shylock, as a Jew and therefore an "alien", having attempted to take the life of a citizen, has forfeited his property, half to the government and half to Antonio, leaving his life at the mercy of the Duke. The Duke pardons Shylock's life. Antonio asks for his share "in use" until Shylock's death, when the principal will be given to Lorenzo and Jessica. At Antonio's request, the Duke grants remission of the state's half of forfeiture, but on the condition that Shylock convert to Christianity and bequeath his entire estate to Lorenzo and Jessica (IV,i).
Bassanio does not recognise his disguised wife, but offers to give a present to the supposed lawyer. First she declines, but after he insists, Portia requests his ring and Antonio's gloves. Antonio parts with his gloves without a second thought, but Bassanio gives the ring only after much persuasion from Antonio, as earlier in the play he promised his wife never to lose, sell or give it. Nerissa, as the lawyer's clerk, succeeds in likewise retrieving her ring from Gratiano, who does not see through her disguise.
At Belmont, Portia and Nerissa taunt and pretend to accuse their husbands before revealing they were really the lawyer and his clerk in disguise (V). After all the other characters make amends, Antonio learns from Portia that three of his ships were not stranded and have returned safely after all.