We develop a model of hierarchies based on the allocation of authority. A firm's owners have ultimate authority over a firm's decisions, but they have limited time or capacity to exercise this authority. Hence owners must delegate authority to subordinates. However, these subordinates also have limited time or capacity and so further delegation must occur. We analyze the optimal chain of command given that different agents have different tasks: some agents are engaged in coordination and others in specialization. Our theory throws light on the nature of hierarchy, the optimal degree of decentralization, and the boundaries of the firm.