# How node sizes are calculated?

**URL:** <https://discourse.nodered.org/t/how-node-sizes-are-calculated/85454>\
**Category:** General\
**Created:** [12 February 2024 14:26 UTC](https://discourse.nodered.org/t/how-node-sizes-are-calculated/85454 "2024-02-12T14:26:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![riri](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@riri](https://discourse.nodered.org/u/riri)\
**Post date:** [12 February 2024 14:26 UTC](https://discourse.nodered.org/t/how-node-sizes-are-calculated/85454/1 "2024-02-12T14:26:50Z")

</div>

Hi everyone,

when I use a node and I name it the size changes depending on the length of the name, how is this size calculated?

Thank you in advance for your reply

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 February 2024 14:31 UTC](https://discourse.nodered.org/t/how-node-sizes-are-calculated/85454/2 "2024-02-12T14:31:10Z")

</div>

Hi @riri

As i am certain you are aware, it is calculated based on the label length and the grid size setting.

Do you need to know the actual calculations / is there a technical reason?

You are free to go on a voyage of discovery and browse the source code to find the answer 😃

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [12 February 2024 14:52 UTC](https://discourse.nodered.org/t/how-node-sizes-are-calculated/85454/3 "2024-02-12T14:52:10Z")

</div>

The width makes some allowance for the width of the characters.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/9/39e03ac3844ed8572af11613c8362d4c030b8eec.png)

But if you change the font size it makes no difference

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/8/f807e1f6ca000ae3f9edbaa8479225b85e22e99a.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 February 2024 15:28 UTC](https://discourse.nodered.org/t/how-node-sizes-are-calculated/85454/4 "2024-02-12T15:28:39Z")

</div>

> [@jbudd](#):
>
> But if you change the font size it makes no difference
> 
> ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/8/f807e1f6ca000ae3f9edbaa8479225b85e22e99a.png)

Depends on how you changed the font. Assuming you did this in the browser directly (and not modified a CSS and refreshed the page)? I ask because I am fairly certain the calcs do a `getComputedTextLength` (or `getBBox` or similar) at draw time (in other words, layout does not reflow because a CSS value changed post drawing)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [12 February 2024 16:01 UTC](https://discourse.nodered.org/t/how-node-sizes-are-calculated/85454/5 "2024-02-12T16:01:49Z")

</div>

> [@Steve-Mcl](#):
>
> Assuming you did this in the browser directly (and not modified a CSS and refreshed the page)?

Yes, that's right.

---

<div class="post-metadata">

**Author:** ![riri](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@riri](https://discourse.nodered.org/u/riri)\
**Post date:** [14 February 2024 14:30 UTC](https://discourse.nodered.org/t/how-node-sizes-are-calculated/85454/6 "2024-02-14T14:30:32Z")

</div>

thank you for the answer I look for the size of the default cells because I have to create an algorithm that displays a list of nodes in the form of graph and I would like to avoid that some blocks eat part of the other blocks . I hope someone knew the name of the function that handles this but I will go explore the bowels of node-red

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [14 May 2024 14:30 UTC](https://discourse.nodered.org/t/how-node-sizes-are-calculated/85454/7 "2024-05-14T14:30:51Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
