Zero Signup ToolsFree browser tools

Developer Tools

GitHub Permalink Generator

Build, parse, and convert GitHub, GitLab, and Bitbucket file URLs. Pin to a commit SHA, add a line range, and copy Markdown or HTML in one click.

A permalink pins a file URL to a commit SHA so the link never drifts when the branch advances.

Inputs

Owner is required.

Repository is required.

Branch, tag, or commit SHA is required.

File path is required.

Single line (42), a range (10-20), or the full L-prefixed form (L120-L138). Leave blank to link to the whole file.

Or load a sample

Outputs

Fill in owner, repository, ref, and file path to build a permalink.

How to use

  1. In Build mode, pick the host (GitHub, GitLab, or Bitbucket), then fill in owner, repository, ref, and the file path.
  2. Type an optional line range like 42, 10-20, or L120-L138. Leave it blank to link to the whole file.
  3. Watch the ref status pill: green means a 40-char commit SHA (permanent), amber means a branch or short SHA (can drift).
  4. Use Copy URL for chat, Copy Markdown for READMEs and pull requests, Copy HTML for blog posts, or Copy summary for code review threads.
  5. In Parse mode, paste any github.com, gitlab.com, or bitbucket.org file URL to break it into host, owner, repo, ref, file path, and line range.
  6. If the parsed ref is a branch, paste a full 40-char commit SHA into the Make it permanent helper to rebuild the URL pinned to that commit.

About this tool

GitHub Permalink Generator builds, parses, and repairs permanent links to source files on GitHub, GitLab, and Bitbucket so the URLs you paste into code reviews, blog posts, READMEs, Notion pages, and Stack Overflow answers do not silently drift when the branch advances. A permalink in this context is a file URL whose ref is pinned to a full 40-character commit SHA rather than a moving branch name. Branch URLs look fine the day you share them and quietly point to different code a week later, which is why GitHub itself prompts you to press 'y' on any file view to swap the branch in the URL for the commit SHA. Build mode takes owner, repository, branch or tag or commit SHA, file path, and an optional line range, then assembles a clean URL with the right per-host shape: github.com/owner/repo/blob/SHA/path#L10-L20, gitlab.com/owner/repo/-/blob/SHA/path#L10-20 (single dash on the second number, the GitLab convention), and bitbucket.org/owner/repo/src/SHA/path#lines-10:20 (lines- prefix and a colon separator, the Bitbucket convention). The line-range input is forgiving: 42, 10-20, L120-L138, L10:L20, even L10C5-L20C30 with column suffixes are all accepted and normalised to the right per-host fragment. Output is delivered four ways in a single click: the raw URL for chat, the Markdown link [owner/repo path L10-L20](url) ready for READMEs and pull requests, the HTML anchor with HTML-escaped label ready for blog posts and knowledge bases, and a plain-text summary that prints every part on its own line for code review threads where the full URL is too long. The ref input has a live status pill: a full 40-char SHA is marked permanent in emerald, a short SHA is marked partial in amber (better than a branch but pin to a full SHA for the gold standard), and a branch or tag is marked drift-risk in amber. Parse mode reverses the job: paste any github.com, gitlab.com, or bitbucket.org file URL (with or without https://) and the tool extracts host, owner, repo, ref, file path, and line range, handles the GitLab /-/ prefix automatically, strips the Bitbucket :context tail, and tells you whether the ref is a commit SHA or a branch with the same colour-coded status. When the parsed ref is a branch, a Make it permanent helper appears: paste a full SHA and the tool rebuilds the URL pinned to that exact commit while preserving the file path and line range, so converting a stale branch link into a permalink is one paste away. An Edit in Build tab button drops the parsed inputs into the Build form so you can change the line range, swap the file, or switch the host with a click. Everything is computed locally using the WHATWG URL constructor and small per-host regex matchers, so the repo names, file paths, and commit SHAs you type stay on your device, which makes the tool safe for private repos, unreleased file paths, internal hostnames mirrored from github.com, and confidential code reviews. Useful for engineers turning branch URLs into permalinks before posting them in code review, technical writers citing exact lines in tutorials and blog posts, developer advocates linking to demo code in conference talks, support engineers pointing customers at a specific block of source, security researchers writing up findings, librarians of internal documentation, and anyone who has ever asked the question how do I link to a specific line range on GitHub without it breaking next week.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools