Works on this device
File Path Converter
Paste a path to write it in another style, simplify it, split it, or quote it for a shell. Only the text of the path is used. No file on your device is opened.
Your path
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Enter a path, or choose Try an example.
Result
How it was worked out
How to use this converter
- Choose what you want to do in the menu.
- Convert between Windows, POSIX and file URL: paste a path, choose the style to convert to, and choose how drive letters are written on the POSIX side.
- Remove . and .. from a path: paste a path to get its simplest form.
- Relative path from a folder to a path: enter the folder you start in and the path you want to reach.
- Join parts into one path and Split a path into its parts: add the parts in rows, or paste one path.
- Quote a path for a shell: choose the shell to get the path as one argument.
- Choose Copy path or Download path to keep the result.
How drive letters are written
| Style | Path |
|---|---|
| Windows | C:\Users\Ana\file.txt |
| WSL | /mnt/c/Users/Ana/file.txt |
| Git Bash and MSYS2 | /c/Users/Ana/file.txt |
| Cygwin | /cygdrive/c/Users/Ana/file.txt |
| Letter kept | C:/Users/Ana/file.txt |
| File URL | file:///C:/Users/Ana/file.txt |
| Network path in Windows | \\server\share\file.txt |
| Network path as a file URL | file://server/share/file.txt |
These forms are the usual settings of each program. WSL, Git Bash and Cygwin let a user change where drives are mounted; the tool uses the usual places.
A path style is found from the text when you do not choose it: file: at the start means a file URL, a backslash or a letter and a colon at the start means Windows, and anything else is POSIX.
The rules used
- Converting changes the separators and the start of the path. Names are kept as typed, and
.and..are kept. - File URLs: every character except letters, digits and
-._~is written as a percent sign and two hex digits of its UTF-8 bytes. A space becomes%20. - Removing . and ..: repeated separators become one, each
.is removed, and each..removes the part before it. At the top of a full path a..is dropped. At the start of a relative path it is kept. - Relative path: both paths are simplified, the shared folders at the start are left out, and one
..is written for each folder that is left of the start. - Joining: one separator is put between parts. A part that is a full path starts the result again.
- Splitting: the last name is the text after the last separator, and the extension starts at the last dot of that name.
- Windows names are compared without looking at capital and small letters. POSIX names are compared exactly.
Worked example
The Windows path C:\Users\Ana\My Documents\report 2024.txt is /mnt/c/Users/Ana/My Documents/report 2024.txt in WSL and file:///C:/Users/Ana/My%20Documents/report%202024.txt as a file URL.
The path /var/www/./site/../shared//img/logo.png becomes /var/www/shared/img/logo.png when . and .. are removed.
From the folder /home/ana/projects/site/css to /home/ana/projects/shared/img/logo.png the relative path is ../../shared/img/logo.png: two folders up, then down into shared/img.
Limits you should know
- Only the text is used. The tool does not check that a file exists, and it does not follow symbolic links. If a folder in the path is a link, the real place of
folder/..can be different from the simplified text. - The current folder is not known. A path such as
C:file.txtor\Users\Anadepends on it, so some conversions of such paths are refused. - A Linux path that is not under the drive folder, such as
/home/anain WSL, has a Windows path that depends on how the system is installed. It is not guessed. - A POSIX name can have a backslash, a colon or a question mark. Windows cannot use such names. The tool refuses a backslash and counts the other names that Windows may not accept.
- Paths that start with
\\?\are passed to Windows exactly as written; the tool leaves that start out when it converts and refuses to simplify such a path. - Quoting for a shell covers the path as one argument. For a whole Windows command line use the Windows Command Line Escaper, and for PowerShell text the Powershell String Escaper.
- A path can have up to 4,096 characters. The limits of real systems are often lower; see the Path Length Checker.