I present a model of offshoring decisions with heterogeneous firms, random adjustment costs, and endogenous markups. The model proposes a tractable probabilistic framework that goes beyond the conventional view of self-selection of more productive firms into offshoring. By characterizing the offshoring decision as a lumpy investment decision subject to heterogeneous adjustment costs, the model obtains an inverted-U relationship between firm-level productivity and the probability of offshoring. A tougher competitive environment (due, for example, to trade liberalization in final goods) has two opposing effects on firm-level offshoring likelihood: the conventional selection effect - accounting for the negative effect of competition on offshoring profits - and an escape-competition effect - accounting for the effect of competition on the opportunity cost of offshoring. In addition, the model highlights strong complementarities between offshoring and exporting decisions.