The HTML sanitizer is used to clean up a markup in HTML fields automatically. It helps to eliminate code and protect against security concerns like cross-site scripting attacks.