HTML Guides for mailto
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
This mailto: link has a line break inside its href, and a URL can't contain a raw line break.
It usually happens when the attribute value is split across two lines in the source, often right after mailto:, by a template, a CMS field or an editor that wraps long lines. The validator says the line break comes "after ilto:", which means anywhere after the scheme: right after the colon, inside the address, or after the comma between two recipients. Indentation on the next line doesn't change the message, and an encoded line break such as triggers it too.
A line break at the very start or end of the value isn't reported, because leading and trailing whitespace is stripped from URLs. A line break inside the subject or body parameters gets a different message, "Tab, new line or carriage return found." To put a line break in the message body, encode it as %0D%0A.
Browsers remove line breaks from URLs before following them, so the link often still works, but the markup is invalid. Keep the whole mailto: URL on one line with no whitespace in it. If the tag gets too long, break the line between attributes instead of inside the value.
Invalid example
<a href="mailto:
info@example.com">Email us</a>
Valid example
<a class="contact-link"
href="mailto:info@example.com">Email us</a>
The mailto: link in this href contains a < character, which is not allowed in a URL. It usually appears when an email is pasted in Name <address> form, or when two addresses are joined without a proper separator.
A mailto: URL holds one or more bare email addresses after the colon, nothing else. Angle brackets, spaces, and the Display Name <address> notation used by email clients are not valid URL characters, so the validator rejects the link at the first illegal character. An encoded space (%20) followed by a second copy of the address, as in this case, is a typical sign that a Name <address> string or a pair of addresses was copied straight into the attribute.
To fix it, keep only the address itself. Drop the display name and the angle brackets, and if the link targets several people, separate the addresses with commas.
Invalid example
<a href="mailto:info@example.com%20<info@example.com">Email us</a>
Valid example
A single recipient needs only the bare address:
<a href="mailto:info@example.com">Email us</a>
For more than one recipient, separate the addresses with commas:
<a href="mailto:info@example.com,research@example.com">Email us</a>
This mailto: link has a space somewhere in its address, and a URL can't contain a raw space.
The validator says the space comes "after ilto:", which means anywhere after the scheme, not only right after the colon. It flags a space typed after mailto:, a space inside the address, a space after the comma between two recipients, and text or markup left in the attribute after the address, such as mailto:info@example.com <br>. That last case shows up when a template or CMS field drops HTML into the link.
A mailto: URL, defined in RFC 6068, holds one or more bare email addresses after the colon. Some browsers open the mail client anyway, but the extra text can end up in the recipient field.
A space inside the subject or body parameters triggers a different message, "Illegal character in query". Encode those spaces as %20.
To fix it, remove the spaces and anything after the address that isn't part of it. Separate several recipients with a comma and no space.
Invalid example
<a href="mailto: info@example.com">Email us</a>
<a href="mailto:info@example.com, sales@example.com">Email us</a>
<a href="mailto:info@example.com <br>">Email us</a>
Valid example
<a href="mailto:info@example.com">Email us</a>
<a href="mailto:info@example.com,sales@example.com">Email us</a>
This mailto: link has a tab character inside its href, and a URL can't contain a raw tab.
A tab is hard to spot because editors draw it as blank space, so the value can look like it has an ordinary space after the colon. It usually comes from copy and paste, for example from a spreadsheet or a table, where cells are separated by tabs. The validator says the tab comes "after ilto:", which means anywhere after the scheme: right after the colon, inside the address, or after the comma between two recipients. The character reference 	 is decoded before the check, so it triggers the same message.
A tab at the very start or end of the value isn't reported, because leading and trailing whitespace is stripped from URLs. A tab inside the subject or body parameters gets a different message, "Tab, new line or carriage return found." To put a tab in the message body, encode it as %09.
Browsers remove tabs from URLs before following them, so the link usually still opens the mail client with the right address, but the markup is invalid. Delete the tab so the address follows mailto: directly. If you can't see where it is, search the source for 	 and for tab characters, or retype the address.
Invalid example
<a href="mailto:	info@example.com">Email us</a>
<a href="mailto:info@example.com,	sales@example.com">Email sales</a>
Valid example
<a href="mailto:info@example.com">Email us</a>
<a href="mailto:info@example.com,sales@example.com">Email sales</a>
A < character inside an href attribute is not valid in a URL and must be removed or percent-encoded.
The mailto: URL scheme expects a well formed email address directly after the colon, such as mailto:user@example.com. The angle brackets (< and >) sometimes seen around email addresses in mail headers or plain text are not part of the URL syntax. Including them in the href value produces an illegal character error because < and > are not permitted in URIs without percent-encoding.
If angle brackets appear in your markup, they likely got there by copying an address from an email header like From: User <user@example.com> and pasting the whole thing into the link. Strip the brackets so only the bare address remains.
HTML examples
Incorrect
<a href="mailto:<user@example.com>">Email us</a>
Correct
<a href="mailto:user@example.com">Email us</a>
A mailto: link follows URI syntax as defined by RFC 3986, which does not permit raw space characters anywhere in the URI. When the W3C validator encounters a space inside the href value of a mailto: link, it reports it as an illegal character in the scheme data. This most commonly happens due to a typo in the email address itself — for example, accidentally inserting a space in the domain name (example .com) or the local part (user name@example.com). It can also occur when query parameters like subject or body contain unencoded spaces.
This matters for several reasons. First, browsers may truncate or misinterpret the href at the space boundary, meaning the mail client may open with an incorrect or incomplete email address. Second, assistive technologies rely on well-formed URIs to communicate link destinations to users. A malformed mailto: link can confuse screen readers or prevent users from understanding where the link leads. Third, invalid markup signals poor quality to search engines and automated tools.
To fix this issue:
- Check the email address for typos. Remove any accidental spaces in the local part (before
@) or the domain part (after@). - Percent-encode spaces in query parameters. If you're using
subject,body, orccparameters in themailto:URI, replace spaces with%20. - Avoid copying and pasting email addresses from formatted documents, which can introduce non-breaking spaces or other invisible whitespace characters.
Examples
Invalid — space in the email address
A space in the domain name makes the URI invalid:
<a href="mailto:user@example com">Send Email</a>
Valid — corrected email address
Remove the space to form a valid email address:
<a href="mailto:user@example.com">Send Email</a>
Invalid — space in the local part
<a href="mailto:john doe@example.com">Send Email</a>
Valid — space removed from local part
<a href="mailto:johndoe@example.com">Send Email</a>
Invalid — unencoded spaces in subject parameter
<a href="mailto:info@example.com?subject=Hello World">Email Us</a>
Valid — percent-encoded spaces in subject parameter
Replace each space with %20 in query parameter values:
<a href="mailto:info@example.com?subject=Hello%20World">Email Us</a>
Valid — full mailto with multiple parameters
<a href="mailto:support@example.com?subject=Bug%20Report&body=Please%20describe%20the%20issue.">
Report a Bug
</a>
The href value of a mailto: link contains a double quote ("), which the URL can only hold percent-encoded as %22.
The ilto: in the message is the tail of mailto:, and the check covers the whole address after it, so a " at the end of the address gets the same error as one at the start.
Usually the quotes were meant for the attribute and landed after the scheme, as in <a href=mailto:"info@example.com">. No quote follows the =, so HTML reads mailto:"info@example.com" as an unquoted value and copies both " characters into the URL. On that tag the validator also reports “"” in an unquoted attribute value. If a space follows the stray quote, the value ends at the space and the message shows only mailto:". Without a closing quote, a single " stays in front of the address.
Quoting the address on purpose doesn't help. In href='mailto:"info@example.com"' and href="mailto:"info@example.com"", the URL still starts with a literal " when the validator checks it. A display name in email header style, such as mailto:"Jane Doe" <info@example.com>, fails for the same reason: the URL holds only the address, and the name goes in the link text. For the rare address with a quoted local part, RFC 6068 asks for the quotes as %22, as in mailto:%22info%22@example.com.
Invalid example
<a href=mailto:"info@example.com">Email us</a>
Valid example
<a href="mailto:info@example.com">info@example.com</a>
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
1K Weekly
1,000 monthly checks. Cancel anytime.
Get 1K Weekly →Join teams across 40+ countries