AZ Tools

Color Sort

Color

Reads any whitespace- or newline-separated list of hex colors (with or without leading #, 3- or 6-digit), dedupes them, and sorts the result by your chosen criterion. Near-greyscale entries (saturation under 5%) are pulled out of the hue ordering and grouped at the start, sorted by lightness, so they don't scatter randomly across the rainbow. Each row shows the swatch, the hex value, and the underlying HSL.

Sort by
Direction
Colors: 11
  • #ef4444
  • #f97316
  • #eab308
  • #22c55e
  • #14b8a6
  • #f8fafc
  • #64748b
  • #3b82f6
  • #0f172a
  • #8b5cf6
  • #ec4899

Duplicates are dropped. Near-greys (S < 5%) bubble to the front of a hue sort, ordered by lightness.

How to use

  1. Paste hex colors — one per line, comma-separated, or any mix.
  2. Pick which axis to sort along and ascending vs descending.
  3. Copy the sorted list back out.

Frequently asked questions

Why does grey sit at the front when sorting by hue?
Hue is undefined for pure greys (saturation = 0) and unstable for near-greys. Grouping low-saturation colours up front and sorting them by lightness gives a more predictable result than letting them land at an arbitrary hue.
Hue vs luma sort — which should I use?
Hue groups colours by their family (all reds, then oranges, then yellows…). Luma sorts by how bright the eye perceives them using Rec. 709 weights — better for stacking colours on a dark/light background by contrast.

Related tools