# Base 64 Encoding

**URL:** <https://community.thunkable.com/t/base-64-encoding/390827>\
**Category:** Questions about Thunkable X\
**Tags:** webapi\
**Created:** [January 3, 2020, 10:13pm UTC](https://community.thunkable.com/t/base-64-encoding/390827 "2020-01-03T22:13:09Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pop\_Gheorghe](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/pop_gheorghe/32/20648_2.png) [@Pop\_Gheorghe](https://community.thunkable.com/u/Pop_Gheorghe)\
**Post date:** [January 3, 2020, 10:13pm UTC](https://community.thunkable.com/t/base-64-encoding/390827/1 "2020-01-03T22:13:09Z")

</div>

I needed a base64 encoder for a web api. But in Thunkable X I did not find any component to suit my needs. Also sending username and passwords to an external API was too insecure for me. I found two solutions to this problem.

**First Solution:**

This implies having access to a hosting service where you could host a PHP script that would do the conversion for you and WebAPI componnent.  
**PHP Script:**

> ```
> <?php
> $str = $_GET['string'];
> $myObj->response = base64_encode($str);
> $myJSON = json_encode($myObj);
> echo $myJSON;
> ?>
> 
> ```

**Thunkable:**

 ![Captură de ecran din 2020-01-03 la 21.12.35](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/9/f93653c4d255a9d18b64d80136f4b61d781851af.png)

**Second Solution:**  
The second solution is more elegant since you have a function inside your app that is doing the conversion.

 ![Captură de ecran din 2020-01-03 la 23.58.59](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/6/065c8c5e4d92cf931269ea2fd1365dd69f6b6285.png)

From my testing looks like this is working ok. If you find some errors let me know. Probably are due do to the asci conversion list.

Here is a sample project:  
[https://x.thunkable.com/copy/908ad8848e38958367e82fbb8ce2991a](https://x.thunkable.com/copy/908ad8848e38958367e82fbb8ce2991a)

Thank you!

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [January 4, 2020, 2:34pm UTC](https://community.thunkable.com/t/base-64-encoding/390827/2 "2020-01-04T14:34:58Z")

</div>

Hi,

Thank you for your solution, but unfortunately the second example does not work, and there is a better solution on the scrWebApi.

[https://x.thunkable.com/projects/5d70f93f8a62b4079eedaff2/project/properties/designer/](https://x.thunkable.com/projects/5d70f93f8a62b4079eedaff2/project/properties/designer/)

---

<div class="post-metadata">

**Author:** ![Pop\_Gheorghe](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/pop_gheorghe/32/20648_2.png) [@Pop\_Gheorghe](https://community.thunkable.com/u/Pop_Gheorghe)\
**Post date:** [January 4, 2020, 4:22pm UTC](https://community.thunkable.com/t/base-64-encoding/390827/3 "2020-01-04T16:22:11Z")

</div>

@actech if you like to send your data to unknown sources then yes you are right. Btw your link does the same as my first solution.

Related to the fact that the example is not working, can you please detail a little bit. What string you try that did not work?

 ![imagine PNG](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/8/a8fd4148067f6df35835e103e76dbe324e0de0de.png)

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [January 4, 2020, 4:23pm UTC](https://community.thunkable.com/t/base-64-encoding/390827/4 "2020-01-04T16:23:46Z")

</div>

I used the line with the Cyrillic alphabet.

Another problem is that it is not possible to copy blocks between projects in Thunkable X. How many users do you think will want to manually create large function blocks for their project? I think very few.

---

<div class="post-metadata">

**Author:** ![Pop\_Gheorghe](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/pop_gheorghe/32/20648_2.png) [@Pop\_Gheorghe](https://community.thunkable.com/u/Pop_Gheorghe)\
**Post date:** [January 4, 2020, 4:36pm UTC](https://community.thunkable.com/t/base-64-encoding/390827/5 "2020-01-04T16:36:56Z")

</div>

Aaa ok. To work also with other characters beside the standard ASCI you need to update the list for ASCI code and after will work.

Copy/paste function is a Thunkable issue.😄 For example I did copy the blocks one by one to another project because first time I was using [http://api.foxtools.ru](http://api.foxtools.ru), but i need to encode username and password, so sending them to an obscure site that is not even https did not look very safe to me(noob here not expert in security).

In the end is another way to look at the problem till a proper crypto block will be implemented in thunkable.

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [January 5, 2020, 12:04pm UTC](https://community.thunkable.com/t/base-64-encoding/390827/6 "2020-01-05T12:04:39Z")

</div>

To encode a password, they use not a base64, but a cryptographic function. There are universal decoders with which it will not be difficult to get a password from your base64 string.

---

<div class="post-metadata">

**Author:** ![maptheunknown](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@maptheunknown](https://community.thunkable.com/u/maptheunknown)\
**Post date:** [May 23, 2020, 2:58pm UTC](https://community.thunkable.com/t/base-64-encoding/390827/7 "2020-05-23T14:58:23Z")

</div>

> [@Pop\_Gheorghe](#):
>
> [http://api.foxtools.ru](http://api.foxtools.ru)

Hello Guys,

[http://api.foxtools.ru/v2/Base64](http://api.foxtools.ru/v2/Base64) webAPI stopped working for me. It returns “Network request failed”

# This site can’t be reached **[http://api.foxtools.ru/v2/Base64](http://api.foxtools.ru/v2/Base64)** is unreachable.

ERR\_ADDRESS\_UNREACHABLE

Is it working for you? Any ideas why?

Thanks,  
Marco

---

<div class="post-metadata">

**Author:** ![manyone](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manyone](https://community.thunkable.com/u/manyone)\
**Post date:** [May 23, 2020, 4:39pm UTC](https://community.thunkable.com/t/base-64-encoding/390827/8 "2020-05-23T16:39:31Z")

</div>

as an alternative, you can use the code i used in this simple base64 encoder/decoder - if you’re converting short strings (not files!). click on the link below.

> [@Simple Base64 Encoder/Decoder](http://community.thunkable.com/t/simple-base64-encoder-decoder/564113):
>
> i want to share this Base64 Encoder/Decoder app i made just to try the webviewer extension that allows us to apply javascript coded functions on data. in this case, the functions for encoding and decoding base64 are already standard functions in javascript. the full messages being passed are shown in the examples below. (i “borrowed” the server that @actech provided in one of his recent examples to illustration this webviewer extension. thank you!): encoding: \<script\>function encode(data){…

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [May 24, 2020, 9:23am UTC](https://community.thunkable.com/t/base-64-encoding/390827/9 "2020-05-24T09:23:10Z")

</div>

New version on scrWebApi

[https://x.thunkable.com/projects/5d70f93f8a62b4079eedaff2/project/properties/designer/](https://x.thunkable.com/projects/5d70f93f8a62b4079eedaff2/project/properties/designer/)

---

<div class="post-metadata">

**Author:** ![maptheunknown](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@maptheunknown](https://community.thunkable.com/u/maptheunknown)\
**Post date:** [May 26, 2020, 11:21pm UTC](https://community.thunkable.com/t/base-64-encoding/390827/10 "2020-05-26T23:21:59Z")

</div>

Thanks for the suggestion. Unfortunately I need a Base64 encoder for images. I’m converting small thumbnail images to Base64 so I can save it locally in a local storage so the app can still be used offline. Any other suggestion?

---

<div class="post-metadata">

**Author:** ![maptheunknown](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@maptheunknown](https://community.thunkable.com/u/maptheunknown)\
**Post date:** [May 26, 2020, 11:48pm UTC](https://community.thunkable.com/t/base-64-encoding/390827/11 "2020-05-26T23:48:13Z")

</div>

Thanks for the sample Base64 encoder.

Also, will this work for an image that’s stored in Cloudinary? I used to use the [[http://api.foxtools.ru](http://api.foxtools.ru)] and I supply the URL of the image. The sample you showed looks like it accepts a text then it converts to Base64. What I need it a BAse64 encoder that accepts URL of the image then it returns the Base64 string.

Thanks,  
Marco

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [May 27, 2020, 9:15am UTC](https://community.thunkable.com/t/base-64-encoding/390827/12 "2020-05-27T09:15:07Z")

</div>

There are two ways to solve your problem:

1. Find a service that can perform this task

2. Try using JavaScript to do this:

---

<div class="post-metadata">

**Author:** ![maptheunknown](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@maptheunknown](https://community.thunkable.com/u/maptheunknown)\
**Post date:** [May 27, 2020, 2:17pm UTC](https://community.thunkable.com/t/base-64-encoding/390827/13 "2020-05-27T14:17:53Z")

</div>

Thanks! I’ll try the javascript solution but I think the best solution for me is to find another API that encodes imageURL to Base64 like what [[http://api.foxtools.ru](http://api.foxtools.ru)] does. I’ve been searching for days and I cannot find any. I’ve searched in RapidAPI, Google APIs, Amazon, or Microsoft but no luck. It’s weird that no one else provides a simple API that encodes an image to Base64. I just saw some online tools but they don’t have API endpoints.

Let me know if you guys know of any.

Thanks,  
Marco

---

<div class="post-metadata">

**Author:** ![maptheunknown](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@maptheunknown](https://community.thunkable.com/u/maptheunknown)\
**Post date:** [May 28, 2020, 5:01pm UTC](https://community.thunkable.com/t/base-64-encoding/390827/14 "2020-05-28T17:01:02Z")

</div>

> [@maptheunknown](#):
>
> [http://api.foxtools.ru](http://api.foxtools.ru)]

[http://api.foxtools.ru](http://api.foxtools.ru/)] is up again and working perfect! I just wanted to give an update.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:28am UTC](https://community.thunkable.com/t/base-64-encoding/390827/15 "2024-11-08T11:28:56Z")

</div>


