diff --git a/pathauto.inc b/pathauto.inc
index eb5d2e5..8132ddf 100644
--- a/pathauto.inc
+++ b/pathauto.inc
@@ -118,6 +118,9 @@ function _pathauto_existing_alias_data($source, $language = LANGUAGE_NONE) {
 function pathauto_cleanstring($string) {
   $output = $string;
 
+  // Remove all HTML tags from the string.
+  $output = strip_tags($string);
+
   // Optionally transliterate (by running through the Transliteration module)
   if (variable_get('pathauto_transliterate', FALSE)) {
     if (module_exists('transliteration')) {
diff --git a/pathauto.test b/pathauto.test
index 1ca03f4..ef1349f 100644
--- a/pathauto.test
+++ b/pathauto.test
@@ -175,6 +175,9 @@ class PathautoUnitTestCase extends PathautoTestHelper {
     // Test length truncation and duplicate separator removal.
     $tests[' - Pathauto is the greatest - module ever in Drupal history - '] = 'pathauto-greatest';
 
+    // Test that HTML tags are removed.
+    $tests['This <span class="text">text</span> has <br /><a href="http://example.com"><strong>HTML tags</strong></a>.'] = 'text-has-html-tags';
+
     foreach ($tests as $input => $expected) {
       $output = pathauto_cleanstring($input);
       $this->assertEqual($output, $expected, t("pathauto_cleanstring('@input') expected '@expected', actual '@output'", array('@input' => $input, '@expected' => $expected, '@output' => $output)));
