# Converting Base 64 to Hexadecimal

**URL:** https://discourse.nodered.org/t/converting-base-64-to-hexadecimal/34031
**Category:** General
**Created:** [10 October 2020 04:34 UTC](https://discourse.nodered.org/t/converting-base-64-to-hexadecimal/34031 "2020-10-10T04:34:58Z")
**Posts on this page:** 1
**Showing post:** 16

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [10 October 2020 16:44 UTC](https://discourse.nodered.org/t/converting-base-64-to-hexadecimal/34031/16 "2020-10-10T16:44:10Z")

</div>

Here are the docs you need to help

> **[Writing Functions : Node-RED](https://nodered.org/docs/user-guide/writing-functions)**

here is the first part

```auto
var bytes = msg.payload;
if (bytes[0]==01) {
    var temperature = (bytes[3] << 8) + bytes[2];
    var humidity= bytes[6];
    return { 
        payload: {
            temperature: temperature/10, 
            humidity: humidity/2
        }
    }
}
// else {
// var power=bytes[2];
// return {
// power: power
// }
// }

return msg;

```

---

_[View the full topic](https://discourse.nodered.org/t/converting-base-64-to-hexadecimal/34031)._
