Ukrainian Alphabetical Sort

Sort Ukrainian Cyrillic with Г/Ґ and І/И in correct dictionary order

Sorts a list of Ukrainian words into true dictionary order, placing Ґ right after Г and И before І and Ї — orderings a plain Unicode sort gets wrong. Ignores the apostrophe and runs entirely in your browser.

Why not just use a normal Unicode sort?

Unicode code points do not match Ukrainian dictionary order. Ґ (U+0490) sits far from Г (U+0413), and І (U+0406) comes before И (U+0418) in code-point order even though И must come first alphabetically. A raw sort therefore misplaces these letters.

The Ukrainian Alphabetical Sort orders a list of words the way a Ukrainian dictionary does. It fixes the two places where a naive computer sort goes wrong: the position of Ґ relative to Г, and the order of И, І, and Ї.

How it works

The tool defines the full Ukrainian alphabet as an ordered string and assigns each letter a rank from its position in that sequence: А=1, Б=2, … Г=4, Ґ=5, … И=11, І=12, Ї=13, …. To compare two words it converts each to a list of ranks, skipping the apostrophe, then compares position by position — the first differing rank decides the order, and a shorter prefix sorts first. Characters outside the alphabet (Latin letters, digits) receive ranks above every Ukrainian letter so they sort last but remain deterministic.

Notes and example

  • гора, ґанок, голуб sort as голуб, гора, ґанок — Ґ falls in right after the Г words, not at the far end.
  • икати, ірій, їжак sort in exactly that order, because И precedes І precedes Ї.
  • The apostrophe is transparent, so п'ять collates as though it were пять.
  • Tick Sort Z→A to reverse the whole list while keeping the same Ukrainian letter ranking.