In this contribution, we present a technique for in situ determination of the numerical apertures (NAs) of optical microscopes using calibrated diffraction gratings. Many commonly practiced procedures use an external setup to determine the objective and condenser NAs. However, these values may become modified in the used microscope systems, e.g.,by system intrinsic apertures. Therefore, in our improved technique, determination of the imaging NA is conducted in situ within the corresponding microscope at hand. Furthermore, the method has been extended to yield the microscope's illumination NA as well. In total, we tested this procedure for determination of the imaging NA for four different microscope objectives with nominal values of 0.55 and 0.9, together with the illumination NAs for four different circular aperture diaphragms with diameters between 10µm and 500µm using several gratings of different pitches. All determined NA values agree essentially with their nominal values within their experimental uncertainties, but the uncertainties have been reduced by typically an order of magnitude as compared with the manufacturer's specifications.