 <p>For valid xHTML it should have the alt attribute.</p> <p>Something like this would work:</p> <pre><code>$xml = new SimpleXMLElement($doc); // $doc is the html document. foreach ($xml-&gt;xpath('//img') as $img_tag) { if (isset($img_tag-&gt;attributes()-&gt;alt)) { unset($img_tag-&gt;attributes()-&gt;alt); } } $new_doc = $xml-&gt;asXML(); </code></pre>