You asked

How does the nikon af s dx 35mm f 1 8g compare with the 40mm micro for portraits on a d5300?

Here is what the site says about that.

From Nikon AF-S DX 35mm f/1.8G: Nikon AF-S DX 35mm f/1.8G: A prime lens by Nikon for APS-C cameras, 35mm f/1.8. Specs - Maker: Nikon - Focal length: 35mm (prime) - Maximum aperture: f/1.8 - Made for: APS-C sensors - Mounts: Nikon F - Stabilised: no - Autofocus: yes What it frames like - On APS-C (Nikon F): like 52mm on full frame; f/1.8 gives about the depth of field of f/2.7 there. - On the larger-sensor bodies of Nikon F: ...

From Nikon D5300: Nikon D5300: A DSLR by Nikon with a 24.2-megapixel APS-C sensor, announced in 2013. Specs - Maker: Nikon - Mount: Nikon F - Sensor: APS-C, 23.5 x 15.6mm, crop factor 1.5 - Resolution: 24.2 megapixels - Stabilisation: none in the body; use stabilised lenses for slow shutter speeds - Announced: 2013 - Type: DSLR Focal lengths on it Lenses frame like 1.5 times their focal length on full frame: 16mm like 24mm, ...

Quoted from this site's pages.

Ask next

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}.