I study the optimal taxation of robots and labor income in a model in which robots substitute for routine work and complement non-routine work. The model features intensive-margin labor supply, endogenous wages and occupational choice. I show that the optimal robot tax is in general not zero which violates production efficiency. The robot tax is used to exploit general equilibrium effects to compress the wage distribution, making redistribution less distortive, thereby increasing welfare. The sign of the robot tax is ambiguous if routine workers are found in the middle of the wage distribution. Using the model for quantitative analysis based on US data, I find that the optimal robot tax is small and positive.