Many real-life social dilemmas contain third parties who cannot make decisions in the dilemma, but are affected by its outcome (receive externalities) nonetheless. Dilemmas with identical payoffs for decision-making actors may greatly vary in their externalities for third parties. If actors value the welfare of thirds, externalities will affect actors' decisions. We test behavioral predictions from three leading ideas on social preferences (altruism, inequality aversion, competition) in two studies that employ four one-shot, 2-person prisoner's dilemmas (PDs) that differ only in their externalities. The PDs respectively include a third party that (i) is indifferent, (ii) prefers defection, (iii) prefers cooperation. Our results show that while aggregate behavior is not affected by externalities, individual behavior is. Compared to a PD without externalities, prosocial individuals cooperate more when a third benefits from cooperation, but do not defect more when a third benefits from defection. The opposite pattern is found for competitive individuals.