# Bad value “callto:X” for attribute “href” on element “a”: Illegal character in scheme data: space is not allowed.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-callto-x-for-attribute-href-on-element-a-illegal-character-in-scheme-data-space-is-not-allowed
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

When you write a phone link using `<a href="callto:...">`, you may encounter two distinct problems at once. First, the `callto:` scheme is a legacy, non-standard protocol originally associated with Skype. The correct and widely supported URI scheme for telephone links is `tel:`, as defined by [RFC 3966](https://www.rfc-editor.org/rfc/rfc3966). Second, spaces within URI scheme data are illegal characters. URIs must not contain unencoded spaces anywhere, and telephone URIs specifically expect a compact phone number composed of digits, hyphens (`-`), dots (`.`), and an optional leading plus sign (`+`) for international dialing.

The W3C validator raises this error because the value provided to `href` violates URI syntax rules. Browsers may still attempt to handle the link, but behavior will be inconsistent — some mobile browsers may not recognize `callto:` at all, and spaces in the URI can cause the number to be parsed incorrectly or truncated. Using the standard `tel:` scheme with a properly formatted number ensures the link works reliably across devices and platforms, including mobile phones, VoIP applications, and assistive technologies.

### How to fix it

1. **Replace `callto:` with `tel:`** — The `tel:` scheme is the standard for phone number links and is supported by all modern browsers and mobile operating systems.
2. **Remove spaces and slashes** — Strip out any spaces, slashes, or parentheses from the phone number. These characters are not valid in a `tel:` URI without percent-encoding, and they serve no functional purpose in the link target.
3. **Use a leading `+` for international numbers** — If applicable, include the full international dialing code prefixed with `+` (e.g., `+1` for the US, `+49` for Germany). This makes the link work regardless of the caller's location.
4. **Optional visual separators** — If you want visual separators within the `href` for readability in your source code, use hyphens (`-`) or dots (`.`), which are permitted in `tel:` URIs. However, the simplest and safest approach is digits only (plus the optional leading `+`).

## Examples

### Incorrect: `callto:` with spaces and slashes

This triggers the validator error because spaces and slashes are illegal in URI scheme data, and `callto:` is non-standard.

```html
<a href="callto:07142/ 12 34 5">Call us</a>
```

### Incorrect: `tel:` with spaces

Even with the correct `tel:` scheme, spaces in the phone number are still invalid URI characters.

```html
<a href="tel:07142 12 34 5">Call us</a>
```

### Correct: `tel:` with digits only

```html
<a href="tel:0714212345">Call us</a>
```

### Correct: International number with `+` prefix

```html
<a href="tel:+490714212345">Call us</a>
```

### Correct: Using hyphens for readability

Hyphens are valid characters in `tel:` URIs and can improve source code readability without affecting functionality.

```html
<a href="tel:+49-07142-12345">Call us</a>
```

### Displaying a formatted number to the user

You can still show a human-friendly formatted number as the visible link text while keeping the `href` value clean and valid.

```html
<a href="tel:+490714212345">+49 (0) 7142 / 12 34 5</a>
```

This approach gives you the best of both worlds: the link text is easy for users to read, and the `href` value is a valid, standards-compliant `tel:` URI that works reliably across all devices and passes W3C validation.
