An inkjet printer includes a recording head, a spacer, a wiping member, and an inflow preventing member. The recording head includes an ejection surface in which a plurality of ejection ports for ejecting ink are defined. The ejection surface faces a medium transport path. The spacer is disposed in a periphery of the recording head and includes a facing surface, which faces the medium transport path. The wiping member wipes the ejection surface. The inflow preventing member prevents the ink from flowing into a gap between the recording head and the spacer.