If I format my laptop, then all the hardware IDs change, or can I be recognized again in an online game?
No, why should it?
The hardware IDs remain the same, nothing changes.
The hardware ID depends on your computer itself. When formatting you delete only the software, the hardware remains the same.