The invention discloses a method for preparing oxalate: using diazo compounds and α-Br ketones as reaction substrates, and using O 2 As oxygen source and oxidizing agent, visible light is used as energy source, organic dye is used as photocatalyst, and oxalate is obtained through free radical process in organic solvent. The method used in the present invention has the following characteristics: the reaction is more environmentally friendly and economical, the substrate has wider applicability, the later functional group is easier, the reaction condition is mild, it can be carried out in the air, the amount of photocatalyst is less, and the post-treatment is simple. At the same time, the reactants, photocatalysts and other raw materials used in the present invention are cheap and easy to obtain, the reaction composition is reasonable, no ligand is needed, the atom economy is high, the reaction steps are few, and a higher yield can be obtained with only one step of reaction, which is in line with contemporary green The requirements and direction of chemistry and sustainable development are suitable for the synthesis of asymmetrically substituted oxalates that are difficult to synthesize by traditional methods.