C# Path IsPathFullyQualified() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
System.IO

Definition

In C#, Path.IsPathFullyQualified() returns true when a path is complete on its own: it points to exactly one place no matter what the current folder or current drive is. It exists in .NET Core 2.1 and newer (and .NET Standard 2.1).

The rules differ by system. On Linux and macOS, a path is fully qualified when it starts with /. On Windows, it needs a drive and a separator (C:\x, C:/x) or a share (\\server\share). So "/data/x.txt" is fully qualified on Linux but not on Windows, because Windows still has to pick the drive.

This is a static method of System.IO.Path. Call it as Path.IsPathFullyQualified(...); there is no new Path(). Like most Path methods, it only works with text: it never opens, reads, or creates a file, and it works the same whether or not the path exists.

Syntax

Pass a path. The result is a bool. A null path throws, so test it first if needed.

C#
bool a = Path.IsPathFullyQualified("docs/a.txt");                 // false
bool b = Path.IsPathFullyQualified(Path.GetFullPath("docs/a.txt")); // true
CallWhat it does
IsPathFullyQualified("docs/a.txt")false on every system: relative.
IsPathFullyQualified("/data/x.txt")Windows: false. Linux and macOS: true.
IsPathFullyQualified("C:/data/x.txt")Windows: true. Linux and macOS: false.
IsPathFullyQualified(Path.GetFullPath(p))true, on every system.

Use it before you pass a path to code that must not depend on the working folder. If the answer is false, call Path.GetFullPath. Note that "C:x" is rooted but not fully qualified on Windows.

Library declarations
C#
public static bool IsPathFullyQualified(string path);
public static bool IsPathFullyQualified(ReadOnlySpan<char> path);

Parameters

ParameterDescription
pathThe path to test. The string version throws ArgumentNullException for null. The file does not need to exist.

Return Value

Return ValueDescription
booltrue if the path is complete and does not depend on the current directory or drive; otherwise false.

C# Examples

Example 1 — Test Paths That Behave the Same Everywhere

Relative paths are never fully qualified, and any path returned by GetFullPath or GetTempPath always is.

C#
using System;
using System.IO;

class Program {
    static void Main() {
        Console.WriteLine(Path.IsPathFullyQualified("docs/a.txt"));
        Console.WriteLine(Path.IsPathFullyQualified("../a.txt"));
        Console.WriteLine(Path.IsPathFullyQualified("./a.txt"));
        Console.WriteLine(Path.IsPathFullyQualified(Path.GetFullPath("docs/a.txt")));
        Console.WriteLine(Path.IsPathFullyQualified(Path.GetTempPath()));
    }
}

How It Works

  1. Three relative paths. docs/a.txt, ../a.txt, and ./a.txt all depend on the working folder, so each gives False.
  2. GetFullPath completes a path. It adds the working directory in front of the name. The result is complete on its own, so the fourth line is True.
  3. GetTempPath is complete. The temp folder is always returned as a full path for the current system, so the last line is True.
  4. Why these inputs? None has a hand-typed drive or leading slash, which is where Windows and Linux disagree. The next example shows that.

Example 2 — Where Windows and Linux Disagree

Two typed paths give opposite answers. The output below shows both systems honestly. IsPathRooted is printed too, for comparison.

C#
using System;
using System.IO;

class Program {
    static void Main() {
        Console.WriteLine("/data/x.txt fully qualified: " + Path.IsPathFullyQualified("/data/x.txt"));
        Console.WriteLine("/data/x.txt rooted: " + Path.IsPathRooted("/data/x.txt"));
        Console.WriteLine("C:/data/x.txt fully qualified: " + Path.IsPathFullyQualified("C:/data/x.txt"));
        Console.WriteLine("C:/data/x.txt rooted: " + Path.IsPathRooted("C:/data/x.txt"));
    }
}

How It Works

  1. Which block? Only the one for your system is printed when you run it.
  2. On Windows. /data/x.txt is rooted but not fully qualified, because the drive is missing. C:/data/x.txt has a drive and a separator, so it is fully qualified. Windows accepts the forward slash.
  3. On Linux and macOS. A path starting with / is complete, so the first line is True. C:/data/x.txt starts with a letter, so it is only a relative name, and both of its answers are False.
  4. Rooted is never stricter. Whenever the fully qualified answer is True, the rooted answer is True too. The reverse is false on Windows, which is why there are two methods.

Example 3 — Make Any Path Fully Qualified

Check first, then complete the path with GetFullPath only when needed.

C#
using System;
using System.IO;

class Program {
    static string Complete(string p) {
        return Path.IsPathFullyQualified(p) ? p : Path.GetFullPath(p);
    }

    static void Main() {
        string relative = "logs/app.log";
        string full = Complete(relative);

        Console.WriteLine("Before: " + Path.IsPathFullyQualified(relative));
        Console.WriteLine("After: " + Path.IsPathFullyQualified(full));
        Console.WriteLine("Name kept: " + Path.GetFileName(full));

        string temp = Path.GetTempPath();
        Console.WriteLine("Already full, unchanged: " + (Complete(temp) == temp));
    }
}

How It Works

  1. A helper. Complete returns a path that is already fully qualified as it is. Otherwise it asks GetFullPath to add the working folder.
  2. Before and after. The relative logs/app.log gives False. The completed path gives True, on every system.
  3. Only the folder part grows. The file name at the end is still app.log. GetFileName prints it without showing the machine-specific folder.
  4. Full paths pass through. The temp path is already complete, so Complete returns the very same text and the comparison is True.

Frequently Asked Questions

It returns true when a path is complete on its own, with a root and no dependence on the working folder or drive. It does not check that the path exists.
Rooted means the path starts with a separator or a drive. Fully qualified is stricter. On Windows, "/data/x" and "C:x" are rooted but not fully qualified, because they use the current drive or the current folder of a drive.
On Linux, the root of the whole file system is "/", so the path is complete. On Windows, a path that starts with "/" still needs a drive letter, which comes from the current drive. So it is not complete.
Call Path.GetFullPath(path). It adds the working directory to a relative path, or the current drive to a drive-less rooted path, and resolves ".." parts. GetFullPath(path, basePath) uses a base you choose.
No. It was added in .NET Core 2.1 and .NET Standard 2.1. In older projects, use Path.IsPathRooted, or move to newer .NET.

Next: IsPathRooted()

Check whether a path starts from a root (like / or C:\) instead of from the working folder.

IsPathRooted() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

14 people found this page helpful