Carbonates are known to exist in natural products, but their biosynthesis has not been linked to any enzymes. An unusual fungal Baeyer-Villiger monooxygenase CcsB is now revealed to catalyze an in-line carbonate formation via a two-step mechanism of oxygen atom insertions.