Skip to main content
QUIETLYTIC
Developer

GitHub URL Parser

Break a github.com URL into owner, repo, ref, path and line range.

Local · nothing leaves this browser Waiting for a GitHub URL
Esc Clear
Parsed

Paste a GitHub URL on the left.

How it works

A github.com URL is not a git remote — it is a web page address, and its shape encodes which page: a file (`blob`), a directory (`tree`), a commit, a pull request, an issue, or a compare view. This reads the path apart into what it actually addresses, including a #L10-L20 line-range fragment on a file URL, rather than treating the whole thing as an opaque link.

A `blob` URL pins content to a ref, not to "latest"

The segment after `/blob/` is a branch, tag or commit SHA — parsed out separately from the file path, because the two are easy to run together when the branch name itself contains a slash. A URL copied from GitHub's UI after browsing to a tag is pinned to that exact tag, not to whatever the branch points to later.

Example

.../blob/main/src/app.ts#L10-L20 reports ref main, path src/app.ts, and lines 10 through 20 — the exact selection GitHub's own "Copy permalink" button produces after highlighting a range.

Frequently asked questions

How is a github.com URL different from a git remote URL?

A git remote URL addresses a repository for cloning; a github.com URL addresses a web page — a specific file, commit, pull request or comparison. The two look similar but are read completely differently: a remote URL has no concept of a #L10-L20 line range or a /pull/123 path, and a web URL is never something you pass to git clone.

What does the ref on a /blob/ URL actually pin?

Whatever was checked out when the link was made — a branch name, a tag, or a commit SHA, all in the same position in the path. A URL copied while browsing a tag stays pinned to that exact tag even after the branch it came from moves on, which is exactly why GitHub's own "Copy permalink" button swaps the branch name for a SHA before copying.

Related tools

From the intelligence desk