Two other standard Canon EF lenses that you’re likely to consider instead of the 40mm f/2.8 STM are the Canon EF 50mm f/1.4 USM (which sells for almost twice the 40mm f/2.8 at $399.99) and the Canon EF 50mm f/1.8 II (which is priced lower than the others at $125.99).
We tested all three lenses mounted to a Canon EOS 5D Mark II and found that all three lenses scored similarly on our tests despite the price differentials, with the 50mm f/1.4 USM and 50mm f/1.8 II achieving Overall DxOMark Scores of 24 and 25 respectively—both very close to the 40mm f/2.8 STM’s Overall score of 26. In fact, all three achieved admirable Sharpness scores with 15P-Mpix for the two more expensive lenses and a 14P-Mpix for the 50mm f/1.8 II. You can see from our sharpness measurements and field maps (below) that all three lens delivered similarly consistent edge-to-edge sharpness at f/2.8.
When it comes to vignetting, however, the 40mm f/2.8 STM did not perform as well as the other two Canon lenses, with shading that should be better controlled. At f/2.8 on the 40mm lens you can see noticable vignetting across approximately 2/3 of the field, whereas the 50mm f/1.4 USM displayed no significant vignetting at f/2.8 and the 50mm f/1.8 lens displayed vignetting that was only noticeable across 25 percent of the field.
Another obvious competitor to the Canon EF 40mm f/2.8 STM is the even slimmer and lighter Pentax smc DA 40mm f2.8 XS, which was announced last year as a kit lens for the Pentax K-01 hybrid APS-C camera. We tested the two lenses side-by-side, mounting the Canon 40mm lens on an 18-megapixel Canon EOS 7D and the Pentax 40mm lens on the 16-megapixel Pentax K-5 (both APS-C DSLRs).
The Canon EF 40mm f/2.8 STM was able to outscore the Pentax smc DA 40mm f2.8 SX on the Overall DxOMark Score by two points, with its DxOMark Score of 18 (vs. 16 for the Pentax). The main difference was due to the better resolution of the Canon lens mounted on the EOS 7D. This is evidenced by the Sharpness scores of 9P-Mpix for the Canon vs. only 7P-Mpix for the Pentax. You can see from our sharpness measurements and field maps (below) that the Canon couple managed much more consistent edge-to-edge sharpness at f/2.8 and achieved a sharper image in the center of the field at f/4, though it did soften toward the edge of the frame, but at an acceptable level.