Go to Settings > General > About. To the right of "Model Number", you can see the Device Number (M number).
To see the the Model Number (A number) tap on the device number.
On the outside of your device
On an iPhone 8 or later, to find the Model Number (A number), remove the SIM tray and look in the SIM tray slot. Make sure that you're in a well-lit place to assist with reading. The model number is written on the side with the display.
On an iPhone 7 or earlier, an iPad, or an iPod Touch, you'll find the Model Number (A number) on the back of your device.