The invention provides a dual purpose energy-saving boiler for hot water and steam. The boiler comprises an upper water liner, a lower water liner, a main liner body, a subsidiary water tank, a combustion chamber and an electric heating tube, wherein the main liner body comprises an inner circle of a water pipe and an outer circle of a water pipe, and is a pipeline structure, thereby not only increasing the heating area in the main liner body, improving the heat utilization rate of heat energy, but also having strong pressure resistance, preventing occurrence of boiler explosion, and ensuringthe safety of the boiler; after the subsidiary water tank heats cold water by residual heat, the water enters the lower water liner, the main liner body and the upper water liner, thereby improving the efficiency of heat energy, and saving energy. The boiler can select different heat modes conveniently according the requirement of different production situations, selects different single fuels ormixture fuels or electric heating, such as coal, firewood, electricity, fuel, gas and the like. The boiler can be used both as a steam boiler and a hot water boiler, is the energy-saving environment-friendly boiler with steam and hot water dual purposes.