To find what's compatible first they have to be the same brand (AMD CPUs only fit in AMD sockets).
Then they have to have a matching socket, very few CPUs are backwards compatible to older sockets.
Then there often is a chipset requirement too, like the newer 1150 socket CPUs require a newer chipset on the motherboard.