GitHub’s README files are a great way to introduce your project and provide essential information to users. Including images can help illustrate key points, showcase features, and make your README more engaging. In this tutorial, we’ll explore how to add images to your GitHub README file.
Hosting Images in Your Repository
The easiest way to include images in your README file is by hosting them directly in your GitHub repository. To do this:
- Create a new folder in your repository to store your images (e.g.,
images
orscreenshots
). - Add your images to the folder.
- Commit and push the changes to your repository.
Once your images are hosted in your repository, you can link to them using Markdown syntax. The basic format is:

Replace alt text
with a brief description of the image, and path/to/image.jpg
with the relative path to the image file.
For example:

This will display the screenshot.png
image in your README file.
Using Relative Paths
When linking to images in your repository, you can use relative paths to make it easier to manage your files. For instance:

This will display the plot.png
image located in the specified directory.
Using HTML Tags
Alternatively, you can use HTML tags to add images to your README file:
<p align="center">
<img src="your_relative_path_here" width="350" title="hover text">
<img src="your_relative_path_here_number_2_large_name" width="350" alt="accessibility text">
</p>
Replace your_relative_path_here
with the relative path to your image file, and adjust the width
, title
, and alt
attributes as needed.
Tips and Best Practices
When including images in your README file:
- Use descriptive alt text for accessibility purposes.
- Optimize your images to reduce file size and improve page loading times.
- Keep your images organized in a dedicated folder to make it easier to manage your repository.
- Use relative paths to link to images, making it easier to move or rename files without breaking links.
By following these steps and tips, you can effectively include images in your GitHub README file and create a more engaging and informative experience for your users.