What is flux? What is its use?

What is flux? What is its use?

In metallurgy, a flux is a chemical cleaning agent, flowing agent, or purifying agent. Flux may have more than one function at a time. It is used in both extractive metallurgy and metal joining.
Iron ore is used as a flux in the smelting of copper.
As a cleaning agent, flux facilitates soldering, and welding by removing oxidation from the metals to be joined. eg- ammonium chloride or rosin for soldering tin; HCl and ZnCl2 for soldering galvanised Iron.
Molten flux also serves as a heat transfer medium, facilitating heating of the joint by the soldering tool or molten solder.