A boiler comprising - a furnace, - a flue gas flow duct (210, 220, 230, 228, 240) comprising a first section, a second section and a third section, wherein - said first section of the flue gas flow duct is arranged to convey flue gases from said furnace to said second section of the flue gas flow duct, - said second section of the flue gas flow duct is substantially vertical, and - said third section of the flue gas flow duct is substantially vertical, the boiler further comprising - means for collecting ash in the lower part of said second section of the flue gas flow duct, and - a by-pass duct for conveying the flue gases from said second section of the flue gas flow duct to said third section of the flue gas flow duct; in which boiler - said second section of the flue gas flow duct and said third section of the flue gas flow duct are arranged in such a way in relation to each other that the orthogonal projection (P 230) of said third section of the flue gas flow duct on a horizontal plane comprises at least part of the orthogonal projection (P 220) of said second section of the flue gas flow duct on said horizontal plane, - the second section of the flue gas duct is equipped with heat exchanger pipes, - the third section of the flue gas flow duct is equipped with o at least one heat exchanger configured to heat water circulating in the boiler, or o a catalyst; - the heat exchanger pipes in the second section of the flue gas flow duct forming parts of the second section of the flow duct through which the flue gas flows, which have a first average cross-sectional area (A 221) in the horizontal plane, and - the heat exchanger or catalyst in said third section of the flue gas flow duct form parts of the third section of the flow duct through which the flue gas flows, which have a second average cross-sectional area (A 231) in the horizontal plane, characterized in that - the heat exchanger pipes and said heat exchanger or catalyst are configured in such a way that the second average cross-sectional area (A 231) is smaller than the first average cross-sectional area (A 221). - a furnace, - a flue gas flow duct (210, 220, 230, 228, 240) comprising a first section, a second section and a third section, wherein - said first section of the flue gas flow duct is arranged to convey flue gases from said furnace to said second section of the flue gas flow duct, - said second section of the flue gas flow duct is substantially vertical, and - said third section of the flue gas flow duct is substantially vertical, the boiler further comprising - means for collecting ash in the lower part of said second section of the flue gas flow duct, and - a by-pass duct for conveying the flue gases from said second section of the flue gas flow duct to said third section of the flue gas flow duct; in which boiler - said second section of the flue gas flow duct and said third section of the flue gas flow duct are arranged in such a way in relation to each other that the orthogonal projection (P 230) of said third section of the flue gas flow duct on a horizontal plane comprises at least part of the orthogonal projection (P 220) of said second section of the flue gas flow duct on said horizontal plane, - the second section of the flue gas duct is equipped with heat exchanger pipes, - the third section of the flue gas flow duct is equipped with o at least one heat exchanger configured to heat water circulating in the boiler, or o a catalyst; o at least one heat exchanger configured to heat water circulating in the boiler, or o a catalyst; - the heat exchanger pipes in the second section of the flue gas flow duct forming parts of the second section of the flow duct through which the flue gas flows, which have a first average cross-sectional area (A 221) in the horizontal plane, and - the heat exchanger or catalyst in said third section of the flue gas flow duct form parts of the third section of the flow duct through which the flue gas flows, which have a second average cross-sectional area (A 231) in the horizontal plane, - the heat exchanger pipes and said heat exchanger or catalyst are configured in such a way that the second average cross-sectional area (A 231) is smaller than the first average cross-sectional area (A 221).