To what extent do the large urban-rural wage gaps in developing countries reflect a spatial misallocation of labor? We answer this question using a dynamic model of internal migration that encompasses two broad interpretations of these gaps. The first is that workers are misallocated across space due to uninsurable migration risk and incomplete markets. The second is that workers are heterogenous and sort efficiently across space given migration costs. We discipline the model quantitatively using evidence from a controlled migration experiment in Bangladesh and new survey evidence about migration opportunities for potential migrants. We then use the model to compare the status quo to the efficient spatial allocation of workers chosen by a benevolent planner. We conclude that urban-rural wage gaps mostly reflects sorting and migration costs, though improved access to financial markets would still reduce misallocation and improve living standards substantially for some workers.