Place the vanity top in its final installation location. Push it as far back as possible and up against any side walls. You must position the vanity accurately before measuring, since even a 1/8-inch difference will cause problems.
Stretch a tape measure horizontally along the front edge of the cabinet under the vanity top. Add 1/2 to 1 inch to the measurement to allow for overhang on the sides, as desired. Write down the measurement, which is the proper length for the vanity.
Insert a tape measure under the left front edge of the vanity top 1 inch from the end. Push it back until it touches the cabinet. Write this number down. Repeat for the right front edge.
Use the larger measurement of the two as the width of the vanity. You will have plenty to sand down when you install it.