For a flexible labeling of a graph, it is possible to construct infinitely many non-equivalent realizations keeping the distances of connected points constant. We give a combinatorial characterization of graphs that have flexible labelings, possibly non-generic. The characterization is based on colorings of the edges with restrictions on the cycles. Furthermore, we give necessary criteria and sufficient ones for the existence of such colorings.