Skip to main content

Relative & Absolute Pathing

Relative and absolute paths are two ways to specify the location of a file or directory within a file system.

  • Absolute Path: An absolute path provides the complete, unambiguous path from the root directory to the target file or directory. It starts with the root directory, typically denoted as "/" on Unix-like systems or with a drive letter (e.g., "C:") on Windows.

  • Relative Path: A relative path specifies the location of a file or directory relative to the current working directory. It doesn't start from the root but describes how to navigate from the current position.


Relative paths are more flexible and portable, making it easier to move files and directories within a project without breaking references. However, absolute paths ensure precise identification of a file's location regardless of the working directory, which can be essential in some situations.