Humans and animals show cooperative behaviour, but our understanding of cooperation among unrelated laboratory animals is limited. A classic test of cooperation is the iterated Prisoner's Dilemma (IPD) game, where two players receive varying payoffs for cooperation or defection in repeated trials. To determine whether unrelated rats cooperate in the IPD, we tested pairs of rats making operant responses to earn food reward in 25 trials/day. The operant chamber was bisected by a metal screen with a retractable lever and pellet dispenser on each side. When levers extended, rats had 2 s to respond. Mutual cooperation (Reward) delivered three pellets each, mutual defection (Punishment) provided no pellets, and unilateral defection (Temptation) gave five pellets to the defector, while the partner (Sucker) received none. In eight pairs of males (RM-) and females (RF-), cooperation was defined by withholding a response. In seven pairs of RM+ males, cooperation was defined by responding on the lever. In males, food restriction significantly inhibited both cooperation and pellets received. There was no effect of dominance status. Males and females made similar numbers of responses under ad libitum feeding. However, neither food restriction nor dominance status affected responses in females. Rats were subsequently tested for reciprocity in 24 alternating trials/day. A response on the lever within 5 s delivered three pellets to the partner. Females made significantly more responses for their cage-mate than males. Responses within pairs were significantly correlated for males, but not for females. For both sexes, responses declined significantly when paired with an unfamiliar partner who never reciprocated ('bad stooge'). These results demonstrate that rats working for food show cooperation in IPD and direct reciprocity. Their responses depend on food availability and responses of their partner.