Like most things of this nature, scientific experiments determine the SPF number. These experiments occur indoors and expose participants to a light spectrum mimicking intense sun rays. Some participants wear sunscreen, and others don’t.
Scientists use a simple formula to find the SPF number: the number of seconds it takes a section of skin to redden while covered in sunscreen, divided by the number of seconds it takes to redden without sunscreen.