An engine with variable compression ratios that is simple, reliable and cheap is provided. The compression ratio is at maximum at idling, and is at minimum at the max. valve position, and can be changed automatically and continuously under any valve position, so that the compression ratio of the engine will approach to the max. allowable value for detonation, so the engine is of very high efficiency and substantially complete combustion, very low emission of waste gas, and is a target pursued by the automobile industry at present in the world. The principle of the invention is, a link rod of variable lengths is used, and the length of the link rod is depending upon the pressure of the combustible mixture gas before ignition combustion; when the pressure is approaching and exceeding the detonation pressure, the link rod will shorten automatically, the compression ratio will drop, so that the pressure will not increase any more, and detonation is avoided. The key tech in the invention is that the link rod uses a plunger type hydraulic cylinder, the oil in which is supplied and closed by the neck connected by the link rod on the crankshaft, so that the length of the link rod is variable in the compression period, and not variable during the ignition and work period.