A download link can break when a filename contains a literal hash sign. In Quarterly notes #1.pdf, the hash belongs to the name. In a URL, an unescaped # introduces a fragment instead. Encode the filename as one path segment, then attach it to the intended directory path.
This guide uses a fictional download address. It prepares the URL text; it does not upload a document or establish that an example file exists.
Identify the filename before encoding
Suppose the directory is https://example.com/downloads/ and its intended file is named:
Quarterly notes #1.pdf
Keep that raw name separately. Do not paste the domain and directory into the filename input. The directory’s slashes separate path segments; they are not characters that should be encoded along with this name.
This is different from choosing a new article slug. Our slug selection guide concerns naming a draft page. Here, the task is to represent an already chosen filename accurately in a link.
Encode the name with component rules
- Open the URL Encoder and Decoder.
- Choose Encode under Mode.
- Choose Component (encodeURIComponent) under Encoding type.
- Leave Treat + as a space (form style) unchecked.
- Paste
Quarterly notes #1.pdfinto Input and select Convert.
The output is:
Quarterly%20notes%20%231.pdf
Each space becomes %20, while the literal hash becomes %23. The final 1.pdf remains part of the name. MDN documents component encoding and the additional URL syntax characters it escapes.
Append that output to the fixed directory address:
https://example.com/downloads/Quarterly%20notes%20%231.pdf
Do not replace the directory’s / separators with %2F. If your input includes several folders, first identify the intended segments rather than treating the entire path as a single filename.
Check why Full URI is the wrong choice for this raw name
With the same filename, Full URI (encodeURI) leaves the hash unescaped:
Quarterly%20notes%20#1.pdf
MDN’s encodeURI reference explains that this operation preserves structural punctuation. It assumes those characters already have the intended URL role. Here, they do not: the hash is filename data.
Appending that incorrect result would make #1.pdf a fragment, rather than part of the filename path. The URL hash reference describes this separate fragment component. Inspect the address structure, not just whether the resulting text looks clickable.
Round-trip the segment without encoding it twice
Return to the component-encoded result. In this tool, Use output as input switches the mode to Decode and converts immediately. With form-style handling still off, confirm that the result is exactly Quarterly notes #1.pdf, including spaces and capitalization.
A second encode would change each percent sign into %25. For example, %23 becomes %2523; one decode would then leave the intermediate encoding. Keep track of whether a field expects raw text or an encoded segment instead of repeatedly converting until it looks familiar.
Keep form-style spaces out of this path workflow
The form-style option can replace encoded spaces with plus signs. Leave it off for this filename procedure. A plus in a URL path is not the form-query convention for a space. If your task concerns a search parameter instead, use the separate query-value encoding workflow.
Verify the real download destination
Before publishing a real link, check that the host, directory, filename case and file type match the deployed resource. Open the finished URL and inspect the final response or download. Confirm the returned document is the intended version, rather than a login page or a similarly named file.
The encoder and its query parser do not perform that destination check. Correct percent encoding cannot create a missing file, repair permissions or decide how an application routes a download. Keep the original name, encoded segment and verified final address together so the link can be checked again when the file moves.