Prerequisites
Android device with fastboot (Samsung devices typically do not implement this mode in the standard bootloader, but most other manufacturers support it)
rooted device
bootloader unlocked
fastboot utility installed on host computer
adb installed on host computer (not needed, but recommended)
Step 1
Access fastboot
This can be done either via button combination which differs from device to device or the easy method over adb commandadb reboot fastboot
Step 2
Set new IMEIfastboot oem writeimei 123456789012347
Step 3
Check IMEI
Verify that the IMEI has changed successfully run:fastboot getvar imei
which should show the actual IMEI of the device.
Step 4
Rebootfastboot reboot
enjoy