# How to convert local image into base64 encoding

**URL:** <https://community.postman.com/t/how-to-convert-local-image-into-base64-encoding/55372>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [December 6, 2023, 12:11pm UTC](https://community.postman.com/t/how-to-convert-local-image-into-base64-encoding/55372 "2023-12-06T12:11:54Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [December 6, 2023, 12:56pm UTC](https://community.postman.com/t/how-to-convert-local-image-into-base64-encoding/55372/3 "2023-12-06T12:56:38Z")

</div>

You haven’t detailed what you’ve tried, or included details on what code you currently have.

You will not have access to the local file system within the pre-request script.

If the API requires an base64 encoded string, you will either need to decode this before hand using another tool, or you could potentially send a request to Postman Echo as form data including the file, and the response returned will include the base64 encoding which you can then parse and use in your subsequent request.

Have a look at the following post to see how to use Postman Echo to return the base64 encoded string for a file.

> [@How to send a POST request with binary data as request body?](https://community.postman.com/t/how-to-send-a-post-request-with-binary-data-as-request-body/52776/3):
>
> Is that jpeg confidential? Are you ok with sending the jpeg to the Postman Echo service? If you send the request as form data, it will return the base64 encoding. For example… [image] [image] You can parse the response using something similar to the following to just return the base64 encoded string, let response = pm.response.json(); let base64 = response.files["dog.jpg"].split(",")[1]; console.log(base64) If you want to send this is a pre-request script then it will be similar but …

---

_[View the full topic](https://community.postman.com/t/how-to-convert-local-image-into-base64-encoding/55372)._
