Knots have a twisted history in quantum physics. They were abandoned as failed models of atoms. Only much later was the connection between knot invariants and Wilson loops in topological quantum field theory discovered. Here we show that knots tied by the eigenenergy strings provide a complete topological classification of one-dimensional non-Hermitian (NH) Hamiltonians with separable bands. A $mathbb{Z}_2$ knot invariant, the global biorthogonal Berry phase $Q$ as the sum of the Wilson loop eigenphases, is proved to be equal to the permutation parity of the NH bands. We show the transition between two phases characterized by distinct knots occur through exceptional points and come in two types. We further develop an algorithm to construct the corresponding tight-binding NH Hamiltonian for any desired knot, and propose a scheme to probe the knot structure via quantum quench. The theory and algorithm are demonstrated by model Hamiltonians that feature for example the Hopf link, the trefoil knot, the figure-8 knot and the Whitehead link.