How to Add Links, Images, and Code Blocks in Markdown

Links

[Link text](https://example.com)
[Link with a title](https://example.com "Shown on hover")

The bracketed part is what the reader sees; the parenthesized part is where it goes. Adding text in quotes after the URL sets a tooltip that shows on hover in most browsers.

Bare links (autolinks)

<https://example.com>

Wrapping a raw URL in angle brackets turns it into a clickable link without needing bracket-and-parenthesis syntax — handy when the link text and the URL are the same thing anyway.

Images

![Alt text describing the image](path/to/image.jpg)

Identical to link syntax with an exclamation mark in front. The alt text matters for two real reasons: screen readers announce it for accessibility, and it's what shows if the image fails to load.

An image that's also a link

[![Alt text](image.jpg)](https://example.com)

Wrap the image syntax inside link syntax — the image becomes clickable, leading to the URL.

Inline code

Use the `printf()` function here.

Single backticks around a short piece of code or a filename keep it visually distinct from surrounding prose.

Fenced code blocks

```
function greet() {
  console.log("hi");
}
```

Three backticks on their own line, the code, then three more backticks to close it. Some platforms let you specify a language right after the opening fence (like ```javascript) for syntax highlighting — that's a platform-specific extra, not part of every renderer.

Indented code blocks (the older way)

    This line, indented four spaces,
    is also treated as a code block.

This still works in most parsers, but triple-backtick fences are easier to read in the raw file and are the more common convention today.

Check your syntax renders as expected

Small mistakes in this syntax (a missing backtick, a space in the wrong spot) are easy to make and easy to miss just by reading the raw text. The Markdown to HTML tool shows you the actual rendered result in seconds.

Frequently asked questions

Can I link to another section within the same document?
Some platforms auto-generate anchor links from headings (like #getting-started from "Getting Started"), but this is a platform-specific behavior rather than universal base Markdown syntax — check your specific target platform's documentation.