# Why are there two width and height values in the P5.js sketch canvas tag?

**URL:** <https://discourse.processing.org/t/why-are-there-two-width-and-height-values-in-the-p5-js-sketch-canvas-tag/30930>\
**Category:** Beginners\
**Created:** [June 27, 2021, 2:27am UTC](https://discourse.processing.org/t/why-are-there-two-width-and-height-values-in-the-p5-js-sketch-canvas-tag/30930 "2021-06-27T02:27:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sspboyd](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sspboyd/32/1789_2.png) [@sspboyd](https://discourse.processing.org/u/sspboyd)\
**Post date:** [June 27, 2021, 2:27am UTC](https://discourse.processing.org/t/why-are-there-two-width-and-height-values-in-the-p5-js-sketch-canvas-tag/30930/1 "2021-06-27T02:27:56Z")

</div>

The canvas objects created by p5.js have two width and height values. I hadn’t noticed this before and now I’m curious!

The example below is the from the p5 editor.

```auto
<canvas id="defaultCanvas0" class="p5Canvas" style="width: 400px; height: 400px;" width="800" height="800"></canvas>

```

---

<div class="post-metadata">

**Author:** ![KumuPaul](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kumupaul/32/13072_2.png) [@KumuPaul](https://discourse.processing.org/u/KumuPaul)\
**Post date:** [June 27, 2021, 3:50am UTC](https://discourse.processing.org/t/why-are-there-two-width-and-height-values-in-the-p5-js-sketch-canvas-tag/30930/2 "2021-06-27T03:50:50Z")

</div>

I’m going to guess that this has to do with high DPI displays and pixel density, but that is just a guess.
