The invention discloses an oil cylinder, which includes a piston shaft, a front flange, a cylinder body, a locating sleeve, and a rear flange, wherein the front flange, the cylinder body, the locating sleeve, and the rear flange are sequentially arranged on the piston shaft in a penetrating way, and are matched and connected with each other; and a piston, which can perform reciprocating movement, is arranged in the cylinder body, and an oil inlet port and an oil outlet port are arranged on the cylinder body. By adopting the oil cylinder provided by the invention, a product and discharging oil are completely separated, the oil leakage cannot happen, the service life of the oil cylinder is prolonged, a series of problems caused by the oil leakage are solved, the finished product ratio is improved, the quality of the product is ensured, and the waste of material and the maintenance cost of the equipment are reduced; because an oil discharging channel is arranged, when a sealing part is under limiting wear, oil tightness of a shaft end can be guaranteed; the excess oil discharges from the oil discharging channel designed, so as to play a role of early warning; the oil cylinder has the advantages of simple structure, convenience in assembly, and firm combination among each component, and can ensure the machine to operate normally for a long term with small failure rate; and the oil cylinder has small and aesthetic appearance, and wide application range, and can replace the ordinary oil cylinder to use in various industries in the mechanical field.