There is no federal inheritance tax in Switzerland. Instead, there are cantonal taxes, and each canton sets its own rules. This means that if you are lucky enough to inherit something here, the first thing you need to know is not the tax rate, but which canton the deceased lived in.
The good news for most people is that all cantons exempt direct descendants (children, grandchildren) and spouses or registered partners. In practice, if you are the child of someone who dies in Switzerland, in most cases you pay no Swiss inheritance tax. The cantons of Schwyz and Obwalden go even further: they have no inheritance tax at all, regardless of the degree of kinship.
The situation is different if you are a sibling, nephew or niece, an unregistered partner, or simply a third party. Fees vary greatly depending on the canton and the degree of kinship, and can be as high as 50% in extreme cases. The difference between cantons for the same type of inheritance can be enormous.
One detail that many people living in Switzerland overlook is that if you inherit assets in Spain, this is subject to Spanish inheritance tax, not Swiss. And if you were living outside Spain when the inheritance came into effect, since 2018 you have exactly the same rights as residents of the autonomous community where the assets are located. It is worth checking this with an accountant, as differences between autonomous communities can be significant.