The invention discloses an unmanned aerial vehicle mounted gun. The unmanned aerial vehicle mounted gun comprises a gun body, a main body main frame, a main body auxiliary frame, a first shell, a second shell, a first steering engine, a second steering engine, a sliding block fixing seat, a safety rotating frame, a buffer, a sliding block, a rack fixing seat, a trigger toggle block, a gear and a rack, wherein the main body main frame and the main body auxiliary frame are respectively fixed on two sides of the gun body, the first shell and the second shell are arranged on the outer sides of themain body main frame and the main body auxiliary frame, the sliding block fixing seat, the sliding block, a sliding rail and the buffer are combined into a buffering mechanism, the safety rotating frame and the trigger toggle block are attached and synchronously rotated to form a trigger mechanism, and the second steering engine, the rack, the gear and the rack fixing seat are combined into a firing mechanism. The unmanned aerial vehicle mounted gun is simple in structure, good in buffering performance, smooth in bullet firing, long in service life and suitable for being mounted on an unmanned aerial vehicle.