We analyze the performance of a Brownian ratchet in the presence of geometrical constraints. A two-state model that describes the kinetics of molecular motors is used to characterize the energetic cost when the motor proceeds under confinement, in the presence of an external force. We show that the presence of geometrical constraints has a strong effect on the performance of the motor. In particular, we show that it is possible to enhance the ratchet performance by a proper tuning of the parameters characterizing the environment. These results open the possibility of engineering entropically-optimized transport de- vices.