Place a 3-foot level across the mantel and check for level. Use a torpedo level to see if the shelf is level front to back. Tap shims under the legs as necessary until it's level both ways.
Lightly trace the mantel's outline on the wall in pencil, as shown. This will give you a reference to help position the cleats.
Tip: Mantels are top-heavy. Allowing the shelf to tilt slightly back toward the wall helps hold it in place during installation. You'll pull the legs flush with the wall as you screw to the cleat.