You must compare the specifications of the RAM chip with those of the mainboard from the iMac. First, the form factor must fit. Then you need to pay particular attention to the specifications of the RAM itself (including type, RAM buffer, CAS latency) and the power supply voltage.