My windows rarely stay in the order I opened them. The editor ends up at 4 while the window I check all the time sits at 2, and I want the busy ones on the left.
swap-window exchanges two windows, so each one takes the position of the other.
tmux swap-window -s 3 -t 1
Window 3 moves to position 1 and the old window 1 moves to position 3. If you leave out -s, tmux uses the current window as the source (or the window with a marked pane, if you marked one with select-pane -m). Inside tmux this is enough:
swap-window -t 1
Type it after Ctrl-b :. The swapped window becomes the current one. Add -d to stay where you are:
tmux swap-window -d -s 3 -t 1
The manual says it is an error if no window exists at the source index. To move a window to a number that is still free, use move-window. With move-window -r tmux renumbers all windows of the session in order, following the base-index option.
The indexes follow base-index as well. If you start counting at 1, window 1 in the examples is the first one on your status bar, and a target that does not exist gives an error.
Further reading: tmux manual