The invention relates to a reactor with nitrification and denitrification function. The reactor comprises an inner barrel, an outer barrel, a sewage inlet, a water inlet, a water outlet, an inner tube, a circular seal head, a flat seal head, a sludge discharging hopper, a filler, an aerating apparatus, a microfiltration membrane separator and an ozone device, wherein the circuit seal head is connected at the upper end of the inner barrel, and the sludge discharging hopper is connected at the lower end of the inner barrel; the inner tube is arranged in the inner barrel, and the aerating apparatus is connected under the inner barrel; the filler is filled in a cavity outside the inner tube; one side of the inner barrel is provided with the sewage inlet, while the other side is provided with the water inlet; the inner barrel is connected with the outer barrel through the water inlet; the upper end of the outer barrel is connected with the flat seal head; the microfiltration membrane separator is arranged in the inner barrel; the upper end of the microfiltration membrane separator is connected with the water outlet, while the lower end is provided with the ozone device; and the lower end of the outer barrel is connected with the sludge discharging hopper. Compared with the prior art, the reactor facilitates biological reaction, has high volume loading and small volume, solves the problem of organic matter blockage of the filtering membrane, and simultaneously sterilizes sewage.