In this paper, we provide a dynamic model with heterogeneous agents to study child labor in an economy with idiosyncratic shocks to employment. Households facing adverse shocks may use child labor as a buffer to smooth consumption. We show that the introduction of an unemployment insurance program and/or a universal basic income system help eliminate child labor endogenously in this context. A calibration to South Africa in the 1990s is provided.