If you buy a bar, chain and drive sprocket together then these will all be compatible with each other. The selector guides run off a database that in turn is based on standard information for new chainsaws.
If your chainsaw is second hand or an older model, someone may have fitted a non standard bar, chain or drive sprocket.
It is always worth looking at your existing equipment in order to understand the basics of bar, chain and sprocket identification.