The invention discloses an internal and external air purifier with an automatic filter core replacement prompting function. Outdoor air is connected with an outdoor air inlet cavity through a first fan, the outdoor air inlet cavity and an indoor air inlet cavity are connected through a first electromagnetic valve, indoor air is connected with the indoor air inlet cavity through a second fan, the outdoor air inlet cavity is connected with the filter core through a second electromagnetic valve, the indoor air inlet cavity is directly connected with the filter core, an outlet of the filter core is connected with an air outlet cavity through a heating device, an air pressure sensor is arranged on the inner wall of a case, a dust sensor is arranged in the indoor air inlet cavity, a photoelectric sensor is arranged on the filter core, and a control circuit is connected with the photoelectric sensor, the dust sensor and the air pressure sensor, the two fans, the two electromagnetic valves and the heating device. The internal and external air purifier has the advantages that two modes including an internal circulation mode and an external circulation mode and the function of automatically prompting the filter core replacement are realized, the functions of the air purifier are improved, the purification effect is improved in the method aspect, the problems of vitiated air exhaust incapability during window closing, air purification effect reduction during window opening and the like are solved, and convenience is brought for users.