Free tool · works now

Relative Path Calculator

Calculate clean, portable relative Markdown links and media embeds across nested vault folders.

Runs 100% in your browser. Calculate accurate relative traversal paths, standard Markdown links, and media embeds between arbitrary vault locations.

7Links calculated
1Same directory
1Subdirectories
5Parent traversals (..)
1.3Avg upward steps
Target destination pathsOne target file per line

Paste target Markdown notes or media attachments. Supports deep folder structures, sibling folders, and root documents.

Calculated relative links7 targets resolved
2 UP (..)attachments/images/architecture-overview.png
Relative path:../../attachments/images/architecture-overview.png
SAME / SUBDIRdocs/guides/advanced-configuration.md
Relative path:advanced-configuration.md
Common ancestor:docs/guides/
1 UP (..)docs/overview.md
Relative path:../overview.md
Common ancestor:docs/
SAME / SUBDIRdocs/guides/tutorials/first-vault.md
Relative path:tutorials/first-vault.md
Common ancestor:docs/guides/
2 UP (..)README.md
Relative path:../../README.md
2 UP (..)LICENSE.md
Relative path:../../LICENSE.md
2 UP (..)research/2026/benchmarks.md
Relative path:../../research/2026/benchmarks.md

Click any link or embed chip above to copy the formatted Markdown snippet directly to your clipboard.

The Geometry of Relative Directory Traversal in Markdown Repositories

As documentation websites and personal knowledge vaults expand, notes and media assets naturally settle into hierarchical directories. Organizing by domain—separating guides, reference specifications, meeting logs, and image assets—produces deep directory trees.

However, linking a file at docs/architecture/backend/database.md to an asset at attachments/diagrams/schema.png requires navigating up through three directory levels before descending into the asset folder. Doing this manually is a primary cause of broken links and 404 errors in documentation workflows.

The Lowest Common Ancestor (LCA) Algorithm

The mathematics of computing relative paths between two filesystem locations relies on determining their Lowest Common Ancestor (LCA)—the deepest directory segment shared by both paths.

Consider two files in a typical documentation vault:

The calculation proceeds in three deterministic stages:

  1. Identify the LCA: Splitting both paths into segments reveals that their longest shared directory prefix is docs.
  2. Calculate Upward Traversal: The source directory is docs/guides/advanced (depth 3). The LCA is docs (depth 1). Escaping to the LCA requires 3 - 1 = 2 upward steps (../../).
  3. Append Downward Path: From docs, the target file is located at specs/api.md. Combining the segments yields the exact relative path: ../../specs/api.md.

Why Relative Paths Protect Long-Term Vault Portability

Many applications permit absolute filesystem paths (such as /Users/alex/Vault/attachments/photo.png). While these function seamlessly on the creator's primary workstation, they instantly break when:

By utilizing strict relative paths, your links remain mathematically valid regardless of where the root folder is cloned or mounted.

Wikilinks versus Standard Markdown Relative Links

Obsidian and certain PKM applications support shortest-path wikilinks (e.g. [[schema.png]]), which rely on an in-memory index to resolve targets globally without directory notation. While convenient, this syntax creates complete lock-in: opening the note in GitHub, VS Code, or standard text editors fails to render the image because there is no path reference.

Standard Markdown relative links (![Schema](../../attachments/schema.png)) are universally understood by every Markdown parser and code viewer in existence. This tool generates both formats so you can migrate seamlessly between local vault convenience and public repository standards.

Handling Spaces and URL Encoding

Filenames in human-authored vaults frequently contain spaces (e.g. Architecture Overview.png). In standard CommonMark and GitHub Flavored Markdown, raw spaces in link URLs can terminate the destination address prematurely. This calculator automatically generates clean URL-encoded destinations (Architecture%20Overview.png) to ensure flawless rendering across static site generators and web servers.

Step-by-Step Vault Linking Protocol

  1. Set your source document: Enter the relative path of the note you are currently editing in the source box above.
  2. Paste target paths: Paste the destinations you want to link or embed (documents, diagrams, PDFs, or audio files).
  3. Inspect the traversal matrix: Verify the upward step counts and Lowest Common Ancestor directories.
  4. Click to copy: Click any link or embed chip to copy the ready-to-paste Markdown syntax directly to your clipboard.
  5. Export CSV inventory: Download the spreadsheet CSV to audit relative reference dependencies across your documentation site.

Questions

How does the Relative Path Calculator determine the number of upward (../) steps?

The engine parses both the source document and target destination into directory segments and computes their Lowest Common Ancestor (LCA) folder. It counts the number of directory levels required to ascend from the source file to that common ancestor, generating the exact quantity of ../ traversal prefixes before appending the downward target path.

Why are relative paths superior to absolute paths in Markdown vaults?

Absolute filesystem paths (such as /Users/name/Documents/Vault/note.md or C:\Users\...) embed machine-specific disk paths into your notes. When you sync your vault to another computer, a mobile phone, or a GitHub repository, absolute links immediately break. In contrast, relative paths (such as ../../assets/diagram.png) are completely self-contained and function everywhere.

How does the calculator format media and image embeds differently from standard notes?

When the target file has an image or media extension (.png, .jpg, .svg, .pdf, .mp3), the engine automatically formats the output using standard Markdown embed syntax (![Title](path)) as well as Obsidian wikilink embed syntax (![[target]]). For plain Markdown notes, it generates standard hyperlinked references ([Title](path)).

Why does the tool generate URL-encoded paths (%20) alongside standard paths?

While desktop editors like Obsidian tolerate unencoded spaces in Markdown links, web browsers, static site generators (like Astro, Starlight, and VitePress), and GitHub Markdown parsers frequently fail to resolve link destinations containing raw spaces. Providing URL-encoded paths ensures 100% portability across all web engines.

Can I calculate links from one source note to multiple target files simultaneously?

Yes. Specify your active source document path once, then paste any number of target note or attachment paths into the targets list. The calculator generates complete link matrices and copyable chips for every target in real time.

Does this tool transmit my file structure over the network?

No. All path parsing, Lowest Common Ancestor mathematics, URL encoding, and link formatting execute entirely inside your local browser tab memory. Zero network requests are performed.

Keep your Markdown links durable and portable

Private on-device text intelligence and native Markdown editing in Oyma. Keep your note references permanent across platforms.

tools relative path calculator downloadDownload for Mac

No account needed. Intel Mac build