The purpose of flux is to facilitate the soldering process. The obstacle to a successful solder joint is an impurity at the site of the union, e.g. dirt, oils or oxidation. The impurities can be removed by mechanical cleaning or by chemical means, but the elevated temperatures required to melt the filler metal (the solder) encourages the work piece (and the solder) to re-oxidize. This effect is accelerated as the soldering temperatures increase and can completely prevent the solder from joining to the workpiece. One of the earliest forms of flux was charcoal, which acts as a reducing agentand helps prevent oxidation during the soldering process. Some fluxes go beyond the simple prevention of oxidation and also provide some form of chemical cleaning (corrosion).
For many years, the most common type of flux used in electronics (soft soldering) was rosin-based, using the rosin from selected pine trees. It was ideal in that it was non-corrosive and non-conductive at normal temperatures but became mildly reactive (corrosive) at the elevated soldering temperatures. Plumbing and automotive applications, among others, typically use an acid-based (muriatic acid) flux which provides cleaning of the joint. These fluxes cannot be used in electronics because they are conductive and because they will eventually dissolve the small diameter wires. Many fluxes also act as a wetting agent in the soldering process, reducing the surface tension of the molten solder and causing it to flow and wet the workpieces more easily.