How to Encode Images to Base64 Using Jellycuts
The Original Problem
You have images—binary data. You need to embed them in a text string, like for HTML or a JSON payload. Old protocols, web forms, and simple text fields can’t handle raw images. You need a way to make them "text-safe."
The Solution? Base64.
Base64 isn't encryption. It's an encoding scheme that turns any binary data into a string of plain text using a set of 64 characters (A-Z, a-z, 0-9, +, and /). It’s the digital equivalent of putting a liquid into a container that can be safely shipped with other, non-liquid items. You get a text string that's about 33% larger, but you can embed it anywhere text is accepted.
This is exactly what you can do with a simple, powerful Jellycuts.
In this post, we will show you how to encode images in base64 using Jellycuts
The idea for this shortcut came after reading this Reddit post, where a shortcut for converting images to base64 was discussed. We realized that creating this shortcut in Jellycuts would be quite simple and useful.
Tutorial: Encode an Image in Base64
Below, we show you how to create a shortcut in Jellycuts to encode an image in base64 and display the result.
Step-by-Step Code Creation
Step 1: Import Shortcuts Module
First, import the necessary module to use shortcut functions.
import Shortcuts
Step 2: Customize the Shortcut Appearance
Customize the color and icon of the shortcut for easy identification.
#Color: red, Icon: shortcuts
Step 3: Ask the User to Select an Image
Ask the user to select an image. The selected image will be saved in the selectedImage variable.
selectPhoto(types: [Images], multiple: false) >> selectedImage
Step 4: Encode the Selected Image in Base64
Encode the selected image in base64 and save the result in the base64EncodedImage variable.
encode(input: selectedImage) >> base64EncodedImage
Step 5: Display the Base64 Encoded Result
Display the base64 encoded result in a result window.
showResult(text: base64EncodedImage)
Complete Code for Easy Copying
Here is the complete code, ready to be copied and used in Jellycuts:
import Shortcuts
#Color: red, Icon: shortcuts
// Ask the user to select an image
selectPhoto(types: [Images], multiple: false) >> selectedImage
// Encode the selected image in base64
encode(input: selectedImage) >> base64EncodedImage
// Display the base64 encoded result
showResult(text: base64EncodedImage)
Step 6: Run the Script
Save the script in Jellycuts and export to shortcuts app.

You will be asked to select an image. Once selected, the script will encode it in base64 and display the result, where you can save it as a file or copy it to the clipboard.
Why This Matters for Developers and Enthusiasts
This isn't just a simple trick. It's a foundational building block for more complex automations.
- Custom UIs: Embed images directly into HTML pages you run with Jellycuts to create custom, server-less UIs for your shortcuts.
- API Payloads: Send images or other files to a web service that expects Base64 in its JSON payload. No need to upload and link to a separate file; it's all in one string.
- No Web Hosting: This method avoids the need for external web servers or image hosting. Everything happens directly on your device.
Ready to build your own custom shortcuts?
- Install Jellycuts from the App Store.
- Paste the script into the editor.
- Tap the row to compile it and send it to your Shortcuts library.
Now you can convert any image to a perfectly text-safe string with a single tap. Once you see the Base64 string, you'll start to realize just how many possibilities it opens up for your automations.