# all·markdown

How to add a hyperlink in Markdown

Try it — edit the markdown and watch the preview

Result

Runs entirely in this tab. Open the full editor to work on a real document.

A Markdown hyperlink is square brackets for the text, parentheses for the URL:

[All Markdown](https://allmarkdown.com)

No space between ] and (. That is the single most common mistake — with a space, the whole thing renders as literal brackets and parentheses.

Four forms worth knowing

Inline[text](url). The default, right for most links.

With a title[text](url "Title"). The title shows on hover.

Reference[text][label] with [label]: url defined elsewhere in the file. Keeps long URLs out of the middle of a sentence, and lets you reuse one URL in several places.

Autolink<https://example.com>. Renders the URL as its own link text. Bare URLs without the angle brackets only linkify in some flavours, so the brackets are worth the keystrokes.

Anchors within a page

Headings get an id derived from their text: lowercase, spaces to hyphens, punctuation removed. ## Getting Started becomes #getting-started, so [jump](#getting-started) links straight to it.

![alt text](image.png) is the same syntax with a leading !. The alt text does real work — it is what screen readers announce and what shows if the image fails to load, so it is worth writing properly rather than repeating the filename.

Common questions

What is the basic syntax for a link?
Square brackets around the visible text, immediately followed by parentheses around the URL — [text](https://example.com). There must be no space between the closing bracket and the opening parenthesis, or it renders as literal text.
How do I make a link open in a new tab?
Markdown has no syntax for it, because target is a presentation concern rather than a content one. Either write an <a> tag directly, or let your renderer decide. All Markdown opens external links in a new tab and adds rel="noopener noreferrer" automatically.
When should I use reference links instead of inline ones?
When the URL is long enough to hurt readability of the raw source, or when the same URL appears several times. The definition can sit anywhere in the file, and repeating the label reuses it.
How do I link to a heading in the same document?
Use a fragment made from the heading text — lowercased, spaces turned into hyphens, punctuation dropped. "A Heading" becomes #a-heading. The table of contents in All Markdown generates these automatically.
Why does my URL with parentheses break the link?
The first closing parenthesis ends the link, so a URL containing one is cut short. Percent-encode it as %28 and %29, or wrap the whole URL in angle brackets inside the parentheses.