How to bulk rewrite markdown image paths
- Step 1Load the document — Choose Paste text and paste your Markdown, or Upload file and drop a
.md,.mdx,.markdown, or.txtfile. One file at a time. - Step 2Decide prefix vs find/replace — To migrate every relative path under a new base, leave Find empty. To swap a specific folder, type the old fragment into Find.
- Step 3Set Replace — Enter the new base URL or replacement fragment, e.g.
https://cdn.example.com/img/for a prefix, or/assets/to swap a folder. - Step 4Toggle regex if needed — Leave Treat Find as regex off for a plain substring swap (replaces every occurrence). Tick it to use a pattern with
$1backreferences (rewrites the first match). - Step 5Run and review — Click Run Image Paths. The result appears in a read-only panel — scan it to confirm only image paths changed and absolute URLs were left alone.
- Step 6Copy or download — Use Copy to grab the text, or Download to save the rewritten Markdown under the original filename, then commit it to the new location.
The three rewrite modes
Behaviour is decided entirely by whether Find is empty and whether the regex box is ticked. There are no other controls.
| Find | Regex box | What happens | Example |
|---|---|---|---|
| empty | (ignored) | Replace is prepended to every relative path (prefix mode) | Replace cdn/ turns img/a.png into cdn/img/a.png |
| set | off | Literal substring replace-all — every occurrence of Find swapped for Replace | Find ./images/ → Replace /assets/ rewrites all ./images/ |
| set | on | Find compiled to new RegExp(find); replaces the first match, supports $1 backreferences | Find ^\.\./(.+) → Replace https://cdn.io/$1 |
| empty | (ignored) | Empty Find + empty Replace is a no-op for path content | Output equals input (paths unchanged) |
What is and isn't rewritten
The rewriter walks two regexes: inline images and reference definitions. Everything else is left verbatim.
| Syntax | Rewritten? | Note |
|---|---|---|
 | Yes | Inline images; alt text preserved |
 | Yes | Path rewritten, "title" kept |
[id]: path | Yes | Reference definitions — applies to image AND link refs (the line can't be told apart) |
![alt][id] | No (usage) | The usage has no path; its definition line [id]: path is what gets rewritten |
 | No | Absolute http/https URLs are skipped |
 | No | Protocol-relative // URLs are skipped |
 | No | data: URIs are skipped |
[link](path) | No | Plain links (no leading !) are not inline-rewritten |
Plan limits (markdown family)
File size, character count, and file-per-run limits by tier. Character limit is checked separately from byte size.
| Plan | Max file size | Max characters | Files per run |
|---|---|---|---|
| Free | 1 MB | 500,000 | 1 |
| Pro | 10 MB | 5,000,000 | 10 |
| Pro-media | 50 MB | 20,000,000 | 50 |
| Developer | 500 MB | unlimited | unlimited |
Cookbook
Common migration patterns. Each shows the Find/Replace/regex settings and the before/after of a representative image line.
Prefix every relative image with a new base
Leave Find empty; Replace becomes a prefix on each relative path. Absolute URLs are skipped automatically.
Find: (empty) Replace: https://assets.newsite.com/ Regex: off Before:  After:  Before:  After:  (skipped — already absolute)
Swap an old folder for a new one (literal)
A plain Find swaps every occurrence of the substring across all image paths in the file.
Find: ./images/ Replace: /content/assets/ Regex: off Before:  After:  Reference definition is rewritten too: Before: [fig1]: ./images/fig1.png After: [fig1]: /content/assets/fig1.png
Regex with a backreference
Tick the regex box to capture part of the path and reuse it in Replace via $1. Note: only the first match per path is replaced.
Find: ^\.\./(.+)$ Replace: https://cdn.example.com/$1 Regex: on Before:  After: 
Collapse a redundant path segment
Drop a leading directory by replacing it with nothing. Empty Replace is valid.
Find: static/ Replace: (empty) Regex: off Before:  After: 
Title text is preserved
The optional quoted title after the path survives the rewrite untouched.
Find: (empty) Replace: https://img.site/ Regex: off Before:  After: 
Edge cases and what actually happens
Already-absolute URL
PreservedAny path beginning with http://, https://, //, or data: (case-insensitive) is skipped in all three modes. Re-running the tool on a partly-migrated file won't double-prefix those references.
Path contains a space
Not matchedThe inline regex stops the path at the first whitespace, so  is not rewritten — the un-encoded space breaks the match. URL-encode the space (my%20folder/x.png) before running.
Angle-bracket path ``
Not matchedThe pointy-bracket image form isn't recognised by the matcher. Convert to the plain  form first, e.g. with the prettifier.
Reference definition for a non-image link
By designThe reference-definition pass rewrites [id]: path lines regardless of whether the id is used by an image or a plain link — a definition line carries no marker distinguishing the two. Scope your Find narrowly if you only want image refs changed.
Regex replaces only the first occurrence
By designRegex mode uses new RegExp(find) with no global flag, so only the first match within each individual path is replaced. For replace-all of a literal substring, leave the regex box off (literal mode replaces every occurrence).
Invalid regex pattern
ErrorAn unbalanced group or stray quantifier makes new RegExp(find) throw and the run fails with an error. Test the pattern, escape literal dots as \., and remember backslashes must be doubled when typed.
File exceeds the plan character limit
RejectedThe free tier caps input at 500,000 characters (and 1 MB). Past that the run is blocked before processing — split the document with the splitter or upgrade for a higher ceiling.
Two files dropped at once
Single onlyThis tool processes one file per run (acceptsMultiple is false). Run each document separately, or merge first and rewrite the combined file.
Empty Find and empty Replace
No-opWith nothing to prepend and nothing to find, image paths come back unchanged. Set at least a Replace prefix or a Find substring to make a change.
Frequently asked questions
Does this tool support regex?
Yes. Tick Treat Find as regex and your Find text is compiled with new RegExp(find). You can use $1, $2 backreferences in Replace. One caveat: there's no global flag, so only the first match inside each path is replaced.
Are absolute URLs ever modified?
No. Paths starting with http://, https://, // (protocol-relative), or data: are detected and skipped in every mode, so existing CDN or external links stay exactly as they are.
What's the difference between prefix mode and find/replace?
If Find is empty, Replace is simply prepended to each relative path — a pure prefix. If Find is set, the tool does a substring swap (or regex match) instead of prepending.
Which image syntaxes are rewritten?
Inline images  and , plus reference-definition lines [id]: path. The ![alt][id] usage form carries no path, so its definition line is what changes.
Will it rewrite my reference-style link definitions too?
Yes — a [id]: path line is rewritten whether the id belongs to an image or a regular link, because the definition line itself doesn't say which it is. If you only want image refs touched, choose a Find substring that's unique to your image folder.
Does it move or upload the actual image files?
No. It only edits text references inside the Markdown. Upload or copy the image files to their new location separately, then deploy the rewritten document.
Can it replace every occurrence of a folder name?
Yes — in literal mode (regex box off), Find is replaced everywhere it appears across all image paths via a split/join, so all occurrences are swapped in one pass.
Is the output the same in the browser and via the API?
Yes. The browser processor and the server-safe engine share the same rewriteImagePaths logic, so paste-in-browser and API runs produce identical output.
What file types can I upload?
.md, .mdx, .markdown, and .txt. You can also paste Markdown directly. The output keeps the original filename.
How large a file can I process?
Free allows 1 MB / 500,000 characters. Pro raises it to 10 MB / 5,000,000 characters, Pro-media to 50 MB / 20,000,000, and Developer to 500 MB with no character cap.
How do I check nothing else broke after rewriting?
Run the result through the link validator to confirm references resolve, or eyeball the read-only output panel — only image paths and reference-definition targets should differ.
What if I need to convert my links to reference style first?
Use the reference-link converter to switch between inline and reference notation, then rewrite the consolidated [id]: path definitions here in a single pass.
Privacy first
All Markdown processing runs locally in your browser using JavaScript. No file is ever uploaded to JAD Apps servers — only metadata counters are saved for signed-in dashboard stats.