Should robots be taxed in order to alleviate the distributional effects of technological change? To answer this question, I analyze the optimal taxation of robot inputs and labor income in a Roy model of occupational choice with endogenous wages. To develop intuition, I first study a model with discrete types and no occupational choice in which robots are supplied infinitely elastically on the world market. Agents work in routine and non-routine occupations. The function of the robot tax is to exploit general equilibrium effects to alter the wage distribution prior to income taxation. A tax on robots decreases demand for non-routine work, and raises demand for routine work, which lowers inequality at the top of the income distribution, but raises inequality at the bottom. If the planner values the reduction in inequality at the top sufficiently, there should be a tax on robots. However, if income taxes can be conditioned on occupation, the optimal robot tax is zero. Next, I extend the model to continuous types and endogenous occupational choice. There are now additional effects which counteract wage compression. Still, the pattern of reduced inequality at the top and increased inequality at the bottom remains. Using simulation, I find that it is optimal to tax robots. However, the magnitude of the tax is negligible. However, if the government cannot fully optimize the income tax schedule, a small non-negligible tax on robots can be optimal.