Developer and Text Tools

How to Convert File Paths Between Windows, WSL, Mac and Linux

Backslashes, /mnt/c, \\wsl.localhost, UNC shares and file:// URLs explained, plus how to quote paths safely for bash, PowerShell, cmd and JSON.

Saizul Amin
Saizul Amin5 Nov 2026 · 3 min read
How to Convert File Paths Between Windows, WSL, Mac and Linux

If you write code on Windows and run it in WSL, deploy to Linux servers, share files over a network drive and keep configuration in JSON, you spend part of every week rewriting file paths. The same folder can be written five different ways depending on who is reading it, and a path that works in one place fails silently in another. Knowing the forms and the quoting rules saves a surprising amount of time.

One folder, many spellings

Take a folder called Projects in the user Ann's home on drive C.

  • Windows writes it C:\Users\Ann\Projects. Most Windows programs also accept forward slashes, C:/Users/Ann/Projects, which is handy in config files.
  • WSL mounts Windows drives under /mnt with a lowercase letter: /mnt/c/Users/Ann/Projects.
  • Git Bash and MSYS2 drop the mnt: /c/Users/Ann/Projects. Cygwin uses /cygdrive/c/Users/Ann/Projects.
  • A file URL, as used in browsers and some tools, is file:///C:/Users/Ann/Projects, with spaces written as %20.

Network shares add another family. Windows writes \\server\share\folder, while Linux tools and URLs write //server/share/folder or file://server/share/folder. Going the other way, Windows can open Linux files inside WSL through \\wsl.localhost\Ubuntu\home\ann, or \\wsl$\Ubuntu on older builds.

Converting with the tool

Open the Windows, Mac and Linux Path Converter and paste a path in any of these styles, with or without surrounding quotes. The first path is shown in every form at once, each with a copy button, together with a note on how it was read: a drive path, a UNC share, an absolute POSIX path or a relative one. That note is the quickest way to spot a typo, such as a missing colon after the drive letter.

For many paths, paste them one per line and choose a target style. Blank lines and lines starting with # stay as they are, and lines that have no faithful equivalent are marked instead of being guessed. A home path like ~/notes is a typical example: it means whoever runs the command, so there is no fixed Windows form.

A few rules can be changed. Dot segments are resolved by default, so src\lib\..\app.ts becomes src/app.ts. Trailing separators can be kept, always added or always removed. If you really have a Linux folder called /c, switch off the Git Bash reading so it is not taken for drive C. And if your WSL distribution is Debian or kali-linux, type its name so the \\wsl.localhost form is right.

Quoting for the place you paste into

Converting the separators is only half the job. A path with spaces, brackets or quotes must be protected before a shell or a data format will accept it.

  • bash and zsh. Put the path in single quotes. The only character that needs care is a single quote itself, written as '\'' (close, escaped quote, reopen). A leading ~/ stays outside the quotes so the shell still expands it.
  • PowerShell. Single quotes again, but a single quote inside is doubled.
  • cmd.exe. Double quotes protect spaces and most symbols, but percent signs expand inside batch files, so they are doubled to %%.
  • JSON. Backslashes must be doubled, so C:\data becomes "C:\\data". This is the most common reason a Windows path in a config file stops working.
  • Python. A raw string, r'C:\data', keeps backslashes as they are, except at the very end, where a normal string is used instead.

Pick the quoting style in the tool and, for shells, choose whether to quote every path or only the ones that need it.

Things to remember

The \\?\ prefix lifts the old 260-character limit in Windows, but it disables the handling of . and .., so paths must be clean and absolute. The \\localhost\C$ form uses the administrative share and needs admin rights. Windows ignores letter case in paths while Linux does not, so a converted path can still fail on Linux if the case on disk is different. The converter works on text only: it never touches your disk, and the paths you paste stay in your browser.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages