Use Apple Diagnostics 46
Your Mac includes one of two diagnostics suites, depending on your model’s age – see bit.ly/appltests for full details. To run either, shut down your Mac, then disconnect all external devices except the keyboard, display, and mouse. Next, power on the Mac while holding d. Choose your language if prompted, then the test will start. If issues are found, take a photo of the screen or note down any reference codes before contacting Apple Support.