The invention relates to a special-shaped steel tube forming technology for a semitrailer fence. The special-shaped steel tube forming technology for the semitrailer fence comprises the steps of first, uncoiling, wherein steel strip rolls are unfolded; second, leveling, wherein unfolded steel strips are leveled, and are conveyed to a next station; third, end flattening and butt welding, wherein the head portion and the tail portion of one leveled steel strip are cut to be flattened, and the material tail of the steel strip with ends cut to be flattened and the material head of a next steel strip with ends cut to be flattened are welded together; fourth, beforehand storage, wherein the steel strips subjected to butt joint are sent into a loop storage silo; fifth, forming, wherein the steelstrips in the loop storage silo are sent to a forming machine, and are sequentially bent into tube blanks to be welded; sixth, high efficiency welding, wherein high efficiency welding is carried out after the two ends, in butt joint, of every two adjacent tube blanks are pressed to form a certain open angle; seventh, water cooling, wherein the steel tubes subjected to high efficiency welding are cooled to the room temperature in a spraying manner; eighth, special shape gradual sizing, wherein the steel tubes subjected to water cooling are sized through a sizing unit; and ninth, profile machining, wherein the sized steel tubes are segmented into steel tube bodies of specific lengths.