It varies. There are certain people who are on the top of the pecking order (emperor, king) every time, but below that things get a bit nebulous, particularly before the 12th century. For example, in the thirteenth century, one of the most powerful nobles in France was Enguerrand III, Lord of Coucy. While he was never more than a baron, which is frequently seen as a catchall term for a powerful castellian, he was related to the French royal family by blood and to Henry III of England by marriage. His motto, famously, was "Je suis ni roi, ni prince aussi: Je suis le seigneur de Coucy!" - No king nor prince am I, but the lord of Coucy! Although he is an exceptional case, Enguerrand's example should make us wary of treating noble titles like modern military ranks, leveling up in a video game, or any sort of strict progression. This is doubly the case when it comes to people who hold multiple titles which, when we get later, is a sizable portion of the nobility.
Keeping telkanurus answer in mind I can tell you that in a normal/classical sense this is the order of the titles: Emperor King Duke Count Baron