Toxoids are created by inactivating the natural toxins produced by bacteria using formaldehyde or heat. This process ensures that the toxin is no longer harmful while still being recognizable by the immune system. As a result, when the body encounters the actual toxin, it can mount a rapid and effective immune response.