Skip to main content
HTML Validation

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

About This HTML Issue

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

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

Valid examples

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

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

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

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.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries