You asked

Canon ef 40mm f 2 8 stm vs canon ef 35mm f 2 is usm?

The 35mm f/2 IS USM is the stronger all-round pick, and the 40mm f/2.8 STM is the one to choose only if you want a slightly longer view and don't need the extra light.

The 35mm f/2 gives you one stop more light than the 40mm f/2.8 and adds image stabilisation. In dim rooms and at events, the wider aperture matters more, because it lets you use faster shutter speeds for moving people. Stabilisation steadies the camera, not the subject, so it helps most with still scenes at slow shutter speeds. On full frame the 35mm gives a classic wide-standard view, which suits people in their setting. The 40mm gives a slightly tighter, flatter look and a little less background blur at the same framing, because f/2.8 is slower than f/2. Both lenses are Canon EF and fit the same bodies, so the choice comes down to what you shoot.

On full frame, the Canon EOS 5D Mark IV and Canon EOS 6D Mark II both take either lens. On APS-C, the Canon EOS 90D and Canon EOS 80D work well. On an APS-C body, the 35mm behaves like a 56mm, which is close to the portrait lengths the portraits guide recommends. The focal length converter explains how the crop changes blur. For a first lens, the lenses guide suggests a fast standard prime alongside a standard zoom.

Written by Claude from this site's pages.

From these pages

This answer is for the question above. Each answer is written for the exact question in its address, so a question with its details in it (a budget, what you shoot, what you already have) gets an answer about those details. An answer draws on all 15 pages of the guide and its catalogue of 320 cameras and 1050 lenses. Another question gets its own answer at its own address, as words after /ask/. Or fill in your own: /ask/which-camera-for-{what-you-shoot}-under-{budget}-euros or /ask/which-lens-for-{what-you-shoot}-on-{your-camera}.