Plug your iPhone into your Mac, and go to iTunes (or start it up if it isn’t already open)
Select the iPhone’s icon at the top-right corner of the window, underneath the search box. (If you’ve got more than one iOS device plugged in, this button will say ‘2 devices’ instead – press it and then select the ‘Phone.)
You can now see the iPhone’s summary page. (If it’s showing apps, podcasts or whatever, select Summary from the top bar of tabs.) You can see the iPhone’s capacity, phone number and serial number in the top box; click on the serial number and this will change into the UDID.