Wall-modeled large-eddy simulation introduces a modeling interface (or exchange location) separating the wall-modeled layer from the rest of the domain. The current state-of-the-art is to rely on user expertise when choosing where to place this modeling interface, whether this choice is tied to the grid or not. This paper presents a postprocessing algorithm that determines the exchange location systematically. The algorithm is based on a model for the error in the predicted wall shear stress and a model for the computational cost, and then finds the exchange location that minimizes a combination of the two. The algorithm is tested both a priori and a posteriori using an equilibrium wall model for the flow over a wall-mounted hump, a boundary layer in an adverse pressure gradient, and a shock/boundary-layer interaction. The algorithm produces exchange locations that mostly agree with what an experienced user would suggest, with thinner wall-modeled layers in nonequilibrium flow regions and thicker wall-modeled layers where the boundary layer is closer to equilibrium. This suggests that the algorithm should be useful in simulations of realistic and highly complex geometries.