Bacterial azapteridine-containing phytotoxin toxoflavin is a causal agent of rice grain rot. Here, we heterologously reconstitute Bukholderia toxoflavin biosynthesis in Escherichia coli and identify key pathway intermediates, including the hitherto unknown ribityl-dedimethyl-toxoflavin. Furthermore, we characterized a cofactorless oxidase that converts ribityl-dedimethyl-toxoflavin to ribose and dedimethyl-toxoflavin, the latter of which then undergoes stepwise methylations to form toxoflavin. These findings provide new insights into the biosynthetic pathways of toxoflavin and related triazine metabolites.