A heat exchanger, comprising: a plurality of flat tubes aligned in an up-down direction, extending parallel to each other, and each allowing refrigerant to flow through the flat tube; a header extending in the up-down direction and connected to an end of each of the plurality of flat tubes; and a refrigerant inlet formed at a lower portion of the header, the header having a first plate, a second plate placed between the first plate and the plurality of flat tubes, and a third plate placed between the second plate and the plurality of flat tubes, the first plate having a ridge portion defining a tank space that communicates with the refrigerant inlet and that extends in the up-down direction, the heat exchanger being characterized by the second plate having a first flow passage and a second flow passage, the first flow passage passing through the second plate in a direction of a thickness of the second plate, and extending in the up-down direction in such a manner that an area of the first flow passage coincides with an area of the tank space when the first flow passage is viewed from the direction of the thickness of the second plate, the second flow passage passing through the second plate in the direction of the thickness of the second plate, and extending along the first flow passage in the up-down direction in such a manner that an area of the second flow passage does not coincide with the area of the tank space when the second flow passage is viewed from the direction of the thickness of the second plate, an upper portion of the first flow passage and an upper portion of the second flow passage being connected to each other via a first connecting flow passage, a lower portion of the first flow passage and a lower portion of the second flow passage being connected to each other via a second connecting flow passage formed at a lower position than a position of the first connecting flow passage, the third plate having at least one communicating hole (31, 35) that passes through the third plate in a direction of a thickness of the third plate and allows the first flow passage and each of the plurality of flat tubes to communicate with each other. a plurality of flat tubes aligned in an up-down direction, extending parallel to each other, and each allowing refrigerant to flow through the flat tube; a header extending in the up-down direction and connected to an end of each of the plurality of flat tubes; and a refrigerant inlet formed at a lower portion of the header, the header having a first plate, a second plate placed between the first plate and the plurality of flat tubes, and a third plate placed between the second plate and the plurality of flat tubes, the first plate having a ridge portion defining a tank space that communicates with the refrigerant inlet and that extends in the up-down direction, the heat exchanger being characterized by the second plate having a first flow passage and a second flow passage, the first flow passage passing through the second plate in a direction of a thickness of the second plate, and extending in the up-down direction in such a manner that an area of the first flow passage coincides with an area of the tank space when the first flow passage is viewed from the direction of the thickness of the second plate, the second flow passage passing through the second plate in the direction of the thickness of the second plate, and extending along the first flow passage in the up-down direction in such a manner that an area of the second flow passage does not coincide with the area of the tank space when the second flow passage is viewed from the direction of the thickness of the second plate, an upper portion of the first flow passage and an upper portion of the second flow passage being connected to each other via a first connecting flow passage, a lower portion of the first flow passage and a lower portion of the second flow passage being connected to each other via a second connecting flow passage formed at a lower position than a position of the first connecting flow passage, the third plate having at least one communicating hole (31, 35) that passes through the third plate in a direction of a thickness of the third plate and allows the first flow passage and each of the plurality of flat tubes to communicate with each other.