A filename can be extracted from an absolute HTTP or HTTPS URL by taking the final serialized pathname segment, provided the pathname does not end with a slash.
That rule covers names already present in the URL path. It cannot reveal a download name stored only in a query parameter, redirect, or Content-Disposition response header. For a one-off inspection, URL Parser is a local browser alternative to a hosted filename-extraction API: it separates the URL into normalized components and displays the filename without contacting the pasted site.

What the filename field represents
URL Parser uses the browser's URL parser. Its filename value is the final segment of the serialized pathname after the last slash. For example, the filename in https://cdn.example.com/downloads/annual-report.pdf?version=2 is annual-report.pdf. The query string is a separate component and does not become part of the filename.
A pathname ending in a slash has no filename. In https://example.com/download/?file=report.pdf, the path ends with /, so the filename is empty. The parser does not promote report.pdf from the query string into the filename field.
The final segment also remains in its serialized form. A pathname such as /files/quarterly%20report.pdf produces the filename quarterly%20report.pdf, not quarterly report.pdf. This makes the result suitable for comparing what the browser serialized rather than performing arbitrary path decoding.
Most importantly, the filename is path metadata, not proof of a downloadable file. URL Parser cannot infer a name from a query value, a Content-Disposition header, a redirect destination, or any other network response.
Match the source before choosing the method
Choose the extraction method according to where the name actually appears. A local URL parser is appropriate for a path segment already present in the URL. If the name is available only after an HTTP exchange, the response or redirect data must be obtained separately.
| Where the name appears | Correct source | URL Parser support |
|---|---|---|
| Final path segment | Normalized pathname | Exposed directly as the filename |
| Query key or value | Decoded query-parameter list | Visible for inspection, but not used as the filename |
| Redirect target | Network response or Location header | Unavailable because no request is made |
| Download filename | Content-Disposition response header | Unavailable because no response is fetched |
This distinction prevents a common mismatch: extracting document.pdf from a URL path is a parsing task, while discovering the final name of a redirected download is a network task. A hosted API may offer the latter, but URL Parser deliberately remains an inspector and does not imitate that behavior.
Extract a filename without sending the URL
- Paste one absolute HTTP or HTTPS URL. Start the input with http:// or https://, remove any nonempty username or password, and review the displayed input character count before parsing. Relative paths, scheme-relative references, bare domains, and other schemes are outside the tool's accepted input boundary.
- Select Parse URL and inspect the result. Review the normalized URL, origin, protocol, host, hostname, port, pathname, query string, hash, filename, and ordered query parameters. Confirm that the filename is the expected final serialized pathname segment and that an empty result is explained by a trailing slash rather than a parsing failure.
- Review sensitive values before copying. Query strings and fragments can contain access tokens or other application secrets, even though the result stays in the browser. If the complete JSON is appropriate to share, copy it. The JSON includes the displayed fields plus an ordered array of query-parameter name and value objects; if clipboard access is denied, the full JSON remains available for manual selection.
Parsing, display, and copying happen in the current browser tab. The pasted URL is not uploaded to Lizely, and URL Parser never navigates to the supplied address or sends it a request.
Apply the same rule in application code
URL Parser is a browser inspector, not a production REST endpoint. When an application must extract the filename automatically, use the native URL parser provided by its language or runtime and implement the same final-path-segment rule. The browser behavior is documented in MDN's URL API reference.
A narrow JavaScript implementation can follow these steps:
- Parse the absolute input without supplying a base URL: const parsed = new URL(input);
- Restrict the scheme when required: if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new Error("HTTP or HTTPS required");
- Read the serialized pathname: const pathname = parsed.pathname;
- Return the final segment, or an empty string for a trailing slash: const filename = pathname.endsWith("/") ? "" : pathname.slice(pathname.lastIndexOf("/") + 1);
This snippet implements the extraction rule but does not reproduce every URL Parser input check. Application code may need its own limits, credential policy, and error handling. It also avoids a common mistake: parsing the raw input string directly instead of using the normalized pathname returned by the URL parser.
Runtime behavior is not guaranteed to be identical across environments. URL Parser follows the WHATWG URL model in the browser, while legacy parsers, regular expressions, server frameworks, and operating-system APIs can differ around hosts, backslashes, percent encoding, and special schemes. For a Node.js service, the built-in Node.js URL parsing guide provides a runtime-specific implementation to compare against browser output.
Compare normalized fields instead of raw text
The normalized URL is the browser's href serialization, so it may not contain exactly the characters originally pasted. Compare normalized fields when checking whether two implementations agree.
| Component | Browser-based result | Practical consequence |
|---|---|---|
| Normalized URL | Case and structure can change during serialization | Scheme and host casing normalize, and a missing root path becomes a slash |
| Pathname and filename | Both remain in serialized path form | Percent escapes such as %20 and %2E are not decoded for display |
| Query parameters | An ordered array using URLSearchParams decoding | Percent escapes are decoded, plus signs become spaces, and repeated names remain separate entries |
| Host, port, and origin | Browser-normalized values | An explicit default port such as 443 on HTTPS is removed, while a non-default port remains |
Query parameters follow MDN's URLSearchParams behavior. A key without an equals sign and a key with an explicit empty value both have an empty decoded value, but the tool keeps them as separate ordered entries. Internationalized hostnames are shown in the browser's normalized ASCII form, including xn-- labels; that representation is not a homograph warning, reputation result, or ownership check.
Input boundaries that can stop a parse
Several restrictions affect whether URL Parser can complete the task:
- It accepts one absolute URL at a time. Paths, scheme-relative references, and bare domains are rejected instead of being resolved against the current page.
- Only HTTP and HTTPS are accepted after parsing. Schemes such as javascript:, data:, file:, ftp:, blob:, and mailto: are rejected.
- Any URL containing a nonempty username or password is rejected before parsed fields are constructed.
- Surrounding whitespace, ASCII control characters, and raw backslashes are rejected, preventing pasted newlines or tabs from being silently removed.
- The input accepts up to and including exactly 8,192 UTF-16 code units. The query-parameter array accepts up to and including exactly 200 entries, with repeated names counted separately.
- The complete formatted JSON output has an independent limit of exactly 50,000 UTF-16 code units. Exact boundaries are accepted; the next code unit or parameter entry is rejected, and no input, path, query entry, or output is silently truncated.
Editing the input clears the previous result, error, query list, summary, output, and clipboard status. A failed rerun therefore cannot leave an earlier successful filename visible.
Keep inspection separate from verification
Local processing protects the URL from being uploaded, but it does not make every part of the URL harmless. Query strings and fragments are displayed because they are requested URL components, so review them before copying, logging, or sharing the JSON. Credentials in the user-information portion are rejected, while secrets elsewhere in the URL remain your responsibility.
URL Parser also does not establish that a site exists, a link is safe, a redirect resolves to a particular file, TLS is valid, or a domain is trustworthy. It cannot test reachability because it never opens the link. Use its filename field to inspect URL structure; use the appropriate network and security controls when the task requires live-response verification.