# How to send bytes data to downlink

**URL:** <https://www.thethingsnetwork.org/forum/t/how-to-send-bytes-data-to-downlink/19379>\
**Category:** Application Development\
**Created:** [November 2, 2018, 5:11pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-send-bytes-data-to-downlink/19379 "2018-11-02T17:11:36Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [November 3, 2018, 8:21am UTC](https://www.thethingsnetwork.org/forum/t/how-to-send-bytes-data-to-downlink/19379/4 "2018-11-03T08:21:09Z")

</div>

The screenshot shows you’re using `payload_fields` instead of `payload_raw`. The Base64-encoded payload should go into `payload_raw`. Only use `payload_fields` if you’ve defined an Encoder in TTN Console.

Your `MHgwQjgxMDQwMDAwMDAxRQ==` converts to hexadecimal `30783042383130343030303030303145` which is ASCII text. Converting that hexadecimal representation into an ASCII representation [gives me](https://www.rapidtables.com/convert/number/hex-to-ascii.html) `0x0B81040000001E` again.

So, you’ve encoded twice. That’s wrong.

To send the byte `0x0B` you should send a single value, basically [the bits](https://www.binaryhexconverter.com/hex-to-binary-converter) `00001011`. But above you’re sending the human-readable ASCII characters `0` and `B`, which in hexadecimal notation are the bytes `0x30` and `0x78`, or when displayed as bits are `00110000 01111000`, so twice as many bits. See also [https://www.thethingsnetwork.org/docs/devices/bytes.html](https://www.thethingsnetwork.org/docs/devices/bytes.html)

So, you should not Base64-encode the human-readable hexadecimal **text** representation, but you should Base64-encode the actual binary value. For manual testing use [the Base64 encoder](http://tomeko.net/online_tools/hex_to_base64.php) I already linked to in my answer above, which already expects human-readable hexadecimal text as its input. See also [https://www.thethingsnetwork.org/forum/t/advantage-of-base64-encoding-in-mqtt/3425](https://www.thethingsnetwork.org/forum/t/advantage-of-base64-encoding-in-mqtt/3425)

In short, you should use the example I gave you:

> [@arjanvanb](#):
>
> ```javascript
> "payload_raw": "C4EEAAABLA=="
> 
> ```

How did you Base64-encode the value you’re using?

---

_[View the full topic](https://www.thethingsnetwork.org/forum/t/how-to-send-bytes-data-to-downlink/19379)._
