km should be in the denominator; miles should be in the numerator.
Work Step by Step
We know that km should be in the denominator because the original unit is km. Thus, we must divide by km (thus putting km in the denominator) in order to cancel out the original units. Because we want a new unit of miles, we put miles in the numerator.