How to Fix PDF Hyperlinks Changing # to %23 and Causing 404 Errors
Question details
Users need a way to prevent hyperlinks in PDF files from automatically encoding the hash symbol (#) as %23, which breaks URLs with fragment identifiers and results in 404 errors.

- Product
- Device & OS
- not provided
- Scenario
- Clicking a hyperlink within an exported PDF document that directs to a web URL containing a hash fragment (e.g., jump-to-section links).
- Observed behavior
- The web browser interprets the hash symbol (#) as its URL-encoded equivalent (%23), leading to an invalid web address and a 404 Page Not Found error.
Ensure you have access to the original source document (such as the Microsoft Word or InDesign file) so you can adjust the export settings and regenerate the PDF.
Use the 'Save as PDF' Command with Bookmark Options in Word
Exporting the document directly using the built-in Save As feature with specific bookmark options prevents aggressive URL encoding and preserves the hash character.
Avoid using the 'Print to PDF' function, as virtual printers often strip out active hyperlinks or apply generic text encoding that breaks special characters in URLs.
Launch Microsoft Word and open the document containing your hyperlinks.
Click on 'File' in the top-left corner, then select 'Save As' from the left sidebar.
Choose your save location, and in the 'Save as type' dropdown list, select 'PDF'.
Click the 'Options...' button located below the dropdown list to open the settings dialog.
Under the 'Include non-printing information' section, check the box for 'Create bookmarks using' and select either 'Headings' or 'Word bookmarks' depending on your document structure.
Click 'OK' to close the options, then click 'Save'. The generated PDF will now retain active hyperlinks with the hash symbol intact.

Use a URL Shortener Workaround
If you are unable to fix the encoding issue via document export settings, masking the URL with a link shortener avoids the problematic hash character entirely.
Create Flawless PDFs with Intact Hyperlinks Using WPS Office
Avoid frustrating 404 errors and hyperlink encoding bugs. WPS Office features a highly accurate, built-in PDF exporter that seamlessly transitions your documents into PDFs while perfectly preserving links, bookmarks, and layout formatting.
- 1. Open Your Document in WPS Writer: Launch WPS Office and open your source text document containing the hyperlinks.
- 2. Access the Export Tool: Navigate to the 'Menu' button in the top left corner and select 'Export to PDF'.
- 3. Configure Export Settings: In the dialog box, click on 'Advanced Settings' and ensure that 'Convert cross-references and table of contents to links' is checked.
- 4. Generate the PDF: Click 'Export to PDF'. WPS Office will accurately compile your document, keeping all special characters in your URLs completely intact.

Frequently Asked Questions
Why does the '#' symbol turn into '%23' in my PDF links?
The string '%23' is the standard HTML URL-encoded equivalent of the hash (#) symbol. Some PDF creation tools and print drivers aggressively encode special characters to ensure web compatibility, unintentionally breaking fragment identifiers meant for the browser to read.
Does using 'Print to PDF' fix the hyperlink issue?
No. In most cases, 'Print to PDF' either flattens the document (removing active hyperlinks entirely) or uses generic encoding that causes this exact issue. It is always recommended to use a dedicated 'Save As PDF' or 'Export to PDF' function.
How can I edit a broken link directly inside an existing PDF?
If you don't have the source file, you can use a dedicated PDF Editor like WPS PDF. Open the file, go to the 'Edit' tab, select 'Link', double-click the broken hyperlink, and manually change the '%23' back to a '#' in the destination URL box.




