About This HTML Issue
Spaces in the src attribute of a <source> element are not valid URL characters and must be encoded or removed.
URLs follow strict syntax rules defined in RFC 3986. A space character is not permitted in any part of a URL path. When a file name or path contains spaces, you must replace each space with %20 (the percent-encoded form) or rename the file to avoid spaces altogether.
This applies to all elements that accept a URL, including <source>, <img>, <a>, <script>, and <link>. Browsers often handle spaces gracefully by encoding them automatically, but the HTML is still technically invalid and can cause issues in some contexts, such as when URLs are copied, shared, or processed by other tools.
The best practice is to avoid spaces in file names entirely. Use hyphens (-) or underscores (_) instead. If you can’t rename the files, percent-encode the spaces.
Bad Example
<video controls>
<source src="videos/my cool video.mp4" type="video/mp4">
</video>
Good Example — Percent-Encoded Spaces
<video controls>
<source src="videos/my%20cool%20video.mp4" type="video/mp4">
</video>
Good Example — No Spaces in File Name
<video controls>
<source src="videos/my-cool-video.mp4" type="video/mp4">
</video>
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.