GitHub to jsDelivr Link Converter

GitHub Links
Settings
Options
jsDelivr Links
Copied!

Storing your CSS, JavaScript or images on GitHub is easy, but using a GitHub link directly on your website usually does not work. This free GitHub to jsDelivr Link Converter turns GitHub file, folder and raw links into jsDelivr CDN links that you can use in your pages. You can convert many links at once, choose the version, and copy ready-made HTML tags. The tool runs in your browser, and your links are not sent anywhere. If you are new to GitHub, our Git vs GitHub guide explains the basics.

Table of Contents

How to Use the GitHub to jsDelivr Link Converter

  1. Paste your GitHub links. Add one link per line. You can paste file, folder, raw or repository links. Click Try Sample to see examples.
  2. Choose the version. Keep the version from your link, remove it, or enter your own tag or commit.
  3. Choose the output format. Pick URL only, an HTML tag, or Markdown.
  4. Check the details. Each link shows whether it was converted, plus a short note about versions and caching. Click Open to test the new link.
  5. Copy the result. Click Copy All and paste the links where you need them.

Supported Link Types

GitHub linkjsDelivr result
github.com/user/repo/blob/main/css/style.csscdn.jsdelivr.net/gh/user/repo@main/css/style.css
raw.githubusercontent.com/user/repo/main/js/app.jscdn.jsdelivr.net/gh/user/repo@main/js/app.js
github.com/user/repo/tree/v1.0.0/imagescdn.jsdelivr.net/gh/user/repo@v1.0.0/images/ (folder listing)
github.com/user/repocdn.jsdelivr.net/gh/user/repo/ (repository root)

The tool also understands the newer raw link style with refs/heads/ or refs/tags/ in the path. It ignores extras such as ?raw=true and line anchors like #L10. Release assets (/releases/download/) and Gists are not converted, because jsDelivr serves files stored in repositories.

Settings Explained

  • Keep version. Uses the branch, tag or commit that was in your GitHub link.
  • Remove version. Creates a link without a version. jsDelivr then serves the latest release, or the default branch if the repository has no releases. Fine for testing, but risky for a live site.
  • Custom version. Replaces the version in every link with the one you type, for example v1.2.0.
  • HTML tag output. Creates <script> for JS files, <link rel="stylesheet" /> for CSS files and <img /> for common image types. Other files stay as plain URLs. Blogger's theme editor is strict about XML, so these tags are self-closed to avoid parsing errors.
  • Markdown output. Creates image or link syntax for use in Markdown text.
  • Use minified file. Adds .min to JS and CSS file names. According to jsDelivr's documentation, this returns a minified version, and jsDelivr generates one if none exists.

Which Version Should You Use?

The version you choose decides how stable your link is.

Version typeExampleBest for
Commit hashThe full 40-character hashThe most stable option. The files never change.
Release tag@v1.2.0Stable and easy to read. Recommended for most sites. Create a new tag for every update.
Version range@3 or @3.1Gets the newest matching release automatically. Needs valid semver tags.
Branch@mainTesting. A branch keeps moving as you commit (see our Git branching guide), and links to it are cached for a shorter time.
No version or @latest/gh/user/repo/fileQuick tests only. Not recommended for production.

jsDelivr's documentation says exact versions and commit hashes are effectively cached forever, aliases such as @latest or @3 for up to 7 days, and branches for 12 hours. This also means a file you change under the same tag will not update. If your changed file does not show up, publish a new tag or commit and update your link. jsDelivr's purge tool only helps for @latest and version-alias links, not for exact versions.

Important! jsDelivr is meant for open source files in public repositories. Its documentation says single files larger than 20 MB are not supported by default for GitHub, and HTML files are served as plain text, so a web page will not display. Use it for CSS, JavaScript, fonts and images.

Why Not Use GitHub Links Directly?

GitHub's raw links are made for viewing and downloading files, not for serving them to websites. They are delivered as plain text, with a header that tells browsers not to guess the file type. In most cases, a browser will refuse to run a script or apply a stylesheet loaded from a raw link. GitHub is also not a content delivery network (CDN), so it is not built for fast delivery to visitors around the world.

jsDelivr is a free CDN for open source files. It can serve files straight from GitHub using this format:

https://cdn.jsdelivr.net/gh/user/repo@version/file

The version part can be a release tag, a commit or a branch. The jsDelivr documentation also recommends using npm for projects that are published there, because the files are easier to find and manage.

Using the Links on Blogger

  • CSS. Paste the <link> tag inside the <head> section of your theme (Theme, then Edit HTML).
  • JavaScript. Paste the <script> tag just before </body> so it does not slow down the first view of your page.
  • Images. Use the <img> output inside your post in HTML view, and fill in a useful alt description.
  • Back up first. Download a backup of your theme before you edit it. For more on working with Blogger themes, see how to install a Blogger template properly.

Limitations to Know

  • Branch names with slashes. A name like feature/login cannot be separated from the file path in a GitHub link. The tool takes the first part as the branch. For such cases, copy a link that uses a commit hash instead.
  • The tool does not check that the file exists. Click Open to test each link, and make sure your repository is public.
  • No integrity hash. The tool does not create Subresource Integrity (SRI) attributes.
  • Only GitHub repository links. Release assets, Gists and other hosts are skipped with a clear message.

Frequently Asked Questions

Is the GitHub to jsDelivr Link Converter free?

Yes. The tool is free and runs in your browser. jsDelivr is also a free CDN for open source files.

Why does my raw GitHub link not work as a script or stylesheet?

Raw GitHub links are served as plain text and tell browsers not to guess the file type, so browsers usually refuse to run or apply them. A CDN link from jsDelivr is served as the correct type for the file.

Does it work with private repositories?

No. jsDelivr serves files from public repositories. If the repository is private, the converted link will not load.

Why does my updated file not change on the jsDelivr link?

jsDelivr caches files. Branch links can stay cached for up to 12 hours, and tags and commits are kept permanently once they have been fetched. Publish a new tag or commit for each change and update your link to it.

Should I use the .min option?

Yes, for JavaScript and CSS on a live site, because smaller files load faster. jsDelivr minifies the file if no minified version exists. Test your page after switching, to be sure everything still works.

Final Thoughts

Hosting files on GitHub and serving them through jsDelivr is a simple, free way to keep your site files organized and fast. Convert your links, pin them to a tag or commit, test each one with the Open link, and your pages will load the right files every time.

Post a Comment