The invention relates to an IRIG-B direct current code decoding and time synchronization automatic switching method based on an FPGA, and the method employs an FPGA chip to construct a starting sequence of a preset mode, a time synchronization mode and a timing mode, and achieves the automatic switching among the preset mode, the time synchronization mode and the timing mode. According to the invention, accurate timing can be carried out on the basis of set time and the time of a correction clock can be automatically switched when external time is corrected, accurate timing can be continued on the basis of the time when the external time is corrected and the clock is stopped, second, minute, hour and day are decoded to obtain time signals of month, day, hour, minute, second and the like, and the time signals are output in the form of a serial port at the same time. The updating frequency is 1s, so that whether the time is correct or not can be conveniently and intuitively judged. The FPGA chip is mainly used as a main control chip, code portability is high, and implementation is easy.