A filter device (1100; 1200; 1300; 1400) for removing foreign matters that are contained in a fluid flowing through an annular gap between a shaft and a housing that rotate relative to each other, the filter device (1100; 1200; 1300; 1400) comprising: an annular filter (110; 310) configured to be provided on one of the shaft and the housing; and a rotary seal (120; 220; 320; 420) for sealing an annular gap between the filter (110; 310) and the other of the shaft and the housing that is not provided with the filter (110; 310), characterized in that the rotary seal (120; 220; 320; 420) comprises: an annular sealing member (130; 230; 330; 430) having flexibility; and an annular magnetic field forming member (143; 243; 343; 443) for forming a magnetic field, wherein one of the sealing member (130; 230; 330; 430) and the magnetic field forming member (143; 243; 343; 443) is provided on the filter (110; 310), and the other of the sealing member (130; 230; 330; 430) and the magnetic field forming member (143; 243; 343; 443) is configured to be provided on the other of the shaft and the housing that is not provided with the filter (110; 310), the sealing member (130; 230; 330; 430) is provided on an upstream side of the magnetic field forming member (143; 243; 343; 443) in the direction of the fluid flowing through the filter (110; 310), and the sealing member (130; 230; 330; 430) is configured such that only an annular opposing portion (131; 231; 331; 431) of the sealing member (130; 230; 330; 430) that opposes the magnetic field forming member (143; 243; 343; 443) in an axial direction is made of material that is soaked with magnetic fluid and the other portion of the sealing member (130; 230; 330; 430) is made of a flexible material that does not let the magnetic fluid permeate therethrough, wherein the opposing portion (131; 231; 331; 431) is adapted to make contact with the magnetic field forming member (143; 243; 343; 443) when it is attracted toward the magnetic field forming member (143; 243; 343; 443) due to a magnetic force acting on the magnetic fluid, the resistance of the filter (110; 310) being configured to make the pressure of the fluid in a region in the annular gap on the upstream side of the filter (110; 310) higher than that of the fluid in a region on the downstream side thereof, and the pressure of the fluid in use flowing through the annular gap presses the opposing portion (131; 231; 331; 431) against the magnetic field forming member (143; 243; 343; 443). an annular filter (110; 310) configured to be provided on one of the shaft and the housing; and a rotary seal (120; 220; 320; 420) for sealing an annular gap between the filter (110; 310) and the other of the shaft and the housing that is not provided with the filter (110; 310), characterized in that the rotary seal (120; 220; 320; 420) comprises: an annular sealing member (130; 230; 330; 430) having flexibility; and an annular magnetic field forming member (143; 243; 343; 443) for forming a magnetic field, an annular sealing member (130; 230; 330; 430) having flexibility; and an annular magnetic field forming member (143; 243; 343; 443) for forming a magnetic field, wherein one of the sealing member (130; 230; 330; 430) and the magnetic field forming member (143; 243; 343; 443) is provided on the filter (110; 310), and the other of the sealing member (130; 230; 330; 430) and the magnetic field forming member (143; 243; 343; 443) is configured to be provided on the other of the shaft and the housing that is not provided with the filter (110; 310), the sealing member (130; 230; 330; 430) is provided on an upstream side of the magnetic field forming member (143; 243; 343; 443) in the direction of the fluid flowing through the filter (110; 310), and the sealing member (130; 230; 330; 430) is configured such that only an annular opposing portion (131; 231; 331; 431) of the sealing member (130; 230; 330; 430) that opposes the magnetic field forming member (143; 243; 343; 443) in an axial direction is made of material that is soaked with magnetic fluid and the other portion of the sealing member (130; 230; 330; 430) is made of a flexible material that does not let the magnetic fluid permeate therethrough, wherein the opposing portion (131; 231; 331; 431) is adapted to make contact with the magnetic field forming member (143; 243; 343; 443) when it is attracted toward the magnetic field forming member (143; 243; 343; 443) due to a magnetic force acting on the magnetic fluid, the resistance of the filter (110; 310) being configured to make the pressure of the fluid in a region in the annular gap on the upstream side of the filter (110; 310) higher than that of the fluid in a region on the downstream side thereof, and the pressure of the fluid in use flowing through the annular gap presses the opposing portion (131; 231; 331; 431) against the magnetic field forming member (143; 243; 343; 443).