# Bad value X for attribute “src” on element “video”: Illegal character in path segment. Space is not allowed.

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

A space in the `src` URL of a `<video>` element is an illegal character, so write each space as `%20` or rename the file without spaces.

The `src` attribute takes a valid URL, as defined by the URL Living Standard. Each folder name in the path is a path segment, and so is the file name. None of them can contain a literal space, so the validator flags `my videos/demo.mp4` just as it flags `videos/my demo.mp4`.

Files uploaded through a CMS or copied from a desktop folder often keep the spaces in their names. Most browsers encode the space themselves and play the video anyway, but the markup is still invalid, and a strict URL parser may cut the address off at the first space.

The cleanest fix is to rename the file with hyphens or underscores and update `src` to match. If you can't rename it, replace each space with `%20`. The server decodes `%20` back to a space, so it still finds the original file. The same rule applies to the `src` of a `<source>` element and to the `poster` attribute of `<video>`.

## Invalid example

```html
<video src="videos/product demo.mp4" controls></video>
```

## Valid examples

```html
<video src="videos/product%20demo.mp4" controls></video>

<video src="videos/product-demo.mp4" controls></video>
```
