The Star Wars universe presents an elaborate system of ranks and titles, and the highest position really depends on the era and the faction in question.
In the Jedi Order, the highest title is Grand Master, a rank held by Yoda. As the leader of all Jedi, he was considered the wisest and most powerful among them. His authority extended beyond the Order itself and held weight in the Galactic Republic.
In the Imperial Fleet, the highest rank is Grand Admiral, held by notable figures like Thrawn, Gilad Pellaeon, and Morlish Veed. Meanwhile, the top rank in the Imperial Army was Grand General, such as Malcor Brashin.

The supreme rank across the Imperial Armed Forces was Supreme Commander. This title was held at various times by some of the highest-ranking officers in the Empire — including Darth Vader. Though officially subordinate to Emperor Palpatine, Vader's power over military officials was virtually absolute.