Image Codes for Forums, Markdown and HTML
Once you have a direct image link, you need the right code to display it. Here’s a cheat sheet.
BBCode (forums)
| Goal | Code |
|---|---|
| Show an image | [img]https://…/photo.jpg[/img] |
| Clickable image | [url=https://…/page][img]https://…/photo.jpg[/img][/url] |
| Set width (some forums) | [img width=400]https://…/photo.jpg[/img] |
Support varies by forum software (phpBB, vBulletin, XenForo, SMF), so check your forum’s help page.
Markdown
| Goal | Code |
|---|---|
| Show an image |  |
| Clickable image | [](https://…/page) |
Works on GitHub, GitLab, many docs sites and note apps. Reddit’s editor and Discord handle images differently: on Discord, pasting a direct link usually shows a preview.
HTML
| Goal | Code |
|---|---|
| Show an image | <img src="https://…/photo.jpg" alt="Alt text"> |
| Set size | <img src="…" width="400" height="300" alt="…"> |
| Clickable | <a href="https://…/page"><img src="…" alt="…"></a> |
Tips
- Always add alt text for accessibility.
- Use the direct link (ending in
.jpg,.png,.gifor.webp), not a page link. - Photo to URL gives you all three codes ready to copy after upload.