Slag formation occurs when the flux coating of the welding electrode melts during welding and forms a protective layer over the weld bead. This layer shields the molten metal from contamination while it cools. Once welding is completed, the slag can be removed to reveal the finished weld. Proper slag formation is important because it helps improve weld quality, reduce defects, and produce a cleaner and stronger weld joint.