Center Images in the README.md File of A GitHub Repository

Jul. 09, 2025 • Updated Jul. 11, 2025

In the README.md file of a GitHub repository, we can center images — by default they are aligned left — by using HTML <p> element with specification align="center"1:

1
2
3
<p align="center">
  <img src="xxxx.jpg" width="500"/>
</p>

or a <div> element with align="center"2:

1
2
3
<div align="center">
  <img src="xxxx.jpg" width="500"/>
</div>

By the way, directly specifying align="center" for the <img> element, like:

1
<img src="xxxx.jpg" width="500" align="center"/>

is not functional.


References