What is the best file format for web shortcuts

Links primarily exist on the web, but they can also exist as files in your local file system. There are several formats for storing links as files that open in your web browser. Here’s a quick comparison of the available formats, and a recommendation for which to use for your link files.

Link files — not to be confused with file system links (“symlinks”) — are plain-text files in a structured format that compatible programs can open. The user profile folder in Windows comes with two default folders for storing such links — Links and Favorites — but they’re just regular files that can be stored anywhere on your file system.

The different operating systems call these different things; including Internet Shortcuts, Web Location files, and Web Link files. Windows has its .url files; macOS has its .webloc, .webbookmark, and .webhistory files; and Linux has .desktop files. They’re essentially the same thing.

The biggest difference between the formats is their compatibility and the exact format of their structured data. Let’s explore the compatibility aspect first.

Operating system URL WebLoc Desktop HTML
Open Create Open Create Open Create Open Create
Windows Yes No Yes No
macOS Yes No Yes No
Linux No Yes
Android No

So, the above isn’t too encouraging. There isn’t one link file format that works with all operating systems out of the box. The .url file format has the best support with built-in support in Windows (provided by Internet Browser — not Explorer!) and macOS (provided by Safari). You can add support for .url files to Linux/FreeDesktop environments like GNOME and KDE Plasma by installing url-open. All three programs will defer the actual link to your default web browser of choice.

You could technically craft a .html webpage file that would open in any browser and redirect you to a webpage of your choice. I included it in the table as it’s the only true cross-platform option. However, this solution is only useful for people with some experience with HTML. That brings us neatly on to the next topic: the structured format used in the different file formats.

On Windows, you can create a .url by right-clicking anywhere in File Explorer, choosing New: Shortcut, and filling in a web address. You can, alternatively, create a plain-text file with the following structure (applicable on macOS and other operating systems too):


—and save the file with a .url file extension. You can optionally include the Title= and Desc= properties, but these aren’t displayed or used for anything in any modern operating system. This is the easiest format to read and memorize, so you can create shortcut files whenever you need them. They’re also easy enough to read for a non-technical user who might come across it and for whatever reason opens it as a text file instead of opening the shortcut directly (e.g. Linux users).

Windows has a second shortcut file format with the .lnk file extension. These files can only point to objects in the file system or certain classes of Component Object Model (COM) addressable objects. They can technically be used as shortcuts for internet links, but it isn’t suitable for it. The format is only computer-readable (binary), and the resulting shortcut files may not even work on other Windows computers with different web browsers installed.

The .desktop format on Linux is very similar to the .url format. It requires a different section heading and an additional Type=Link property:

[Desktop Entry]

On macOS, you can create a .webloc (and .webbookmark) by dragging links from your web browser and dropping them in Finder or on the desktop. The structured data format is much more complex, though. This one isn’t something you’re going to remember, and most people would be really confused if they got confronted by the wall of text.

<?xml version="1.0" encoding="utf-8"?>
  "-//Apple//DTD PLIST 1.0//EN"
<plist version="1.0">

Lastly, here’s a minimal .html file that can work as a shortcut file. Unlike the other formats, this document is opened and interpreted directly by your web browser; thus making it the most widely supported format. It also works on mobile platforms.

<!doctype html>

All four formats have optional fields for titles, and descriptions or comments. Desktop search in modern operating systems no longer index these fields or the URL, however. (This was supported historically.) You can search for your bookmark files by their file names.

The most interoperable format is .html, but you need to create the files yourself. This is also the format best suited for sharing with others. The second most interoperable format is .url, but you may still need to manually create them unless you’re on Windows.

So, which is the best format for your bookmark files? None of the formats really offer any extra features or benefits over the other formats (other than interoperability). I recommend using the .url format for most situations. The file extension does a good job at explaining what the file contains. If interoperability is the highest priority, then .html is the way to go. People may expect a .html file to contain a document and not just a link redirect, however.

Bonus content: media types!

Format Media type Registry
.url application/x-mswinurl FreeDesktop.org
.webloc application/xml IANA
.desktop application/x-desktop FreeDesktop.org
.html text/html IANA