Toolyfi
Convert UTF-8 text, inspect Base64URL values, and read a selected local file as a data URI. Copy or download the result after checking the format your system expects.
Toolyfi
Drop image or file here to encode to Base64
or click to browse — PNG, JPG, SVG, PDF, TXT and moreChoose the input that matches the task: UTF-8 text, a Base64 or Base64URL value, or a selected local file. The page makes the current output easier to copy, inspect, or download.
Select a supported image and keep its data URI available for a focused HTML, CSS, JSON, or test-fixture workflow.
Decode the Base64URL payload of a JWT to inspect readable fields; decoding does not verify its signature or trustworthiness.
Encode PDFs, text files, JSON, SVG and more. Drag and drop any file directly onto the tool.
When you decode an image Base64 string, it renders as a visual preview instantly — no extra steps.
The converter uses browser APIs for selected text or files. Treat credentials, tokens, and personal records as sensitive regardless of encoding.
Built for developers, designers, and anyone who works with Base64 encoding and decoding daily.
Select Encode or Decode to run the requested conversion with the browser APIs available on the page.
Upload any image and get a complete data URI ready to drop directly into your HTML img tag or CSS background-image property.
Encode UTF-8 text or a selected file data URI, then decode compatible Base64 text or show a preview for supported image bytes.
Decode a JWT header or payload for a readable format check. This does not validate the signature or authorize token use.
The page adapts its editor and controls for narrower and wider browser windows, while the final integration should still be tested in its target environment.
Base64 is reversible encoding, not encryption. Avoid using a browser conversion workflow to expose credentials, private records, or production tokens.
Use standard Base64, Base64URL, or a data URI only when the receiving system specifies it. Encoding changes representation; encryption protects confidentiality; compression reduces file size.
| Need | Use | Important note |
|---|---|---|
| Text-safe transport | Standard Base64 | Preserve the expected character encoding. |
| URL or token segment | Base64URL | Use the URL-safe alphabet and required padding rules. |
| Small embedded asset | Data URI | Check the larger encoded size before inlining. |
| Keep a secret secret | Encryption or secure secret storage | Base64 is reversible and is not appropriate. |
From web developers to security researchers — Base64 encoding and decoding solves real problems across many fields.
Use a data URI when an implementation specifically benefits from a small embedded asset, then compare the encoded size with a separately served file.
Encode images and attachments for email templates where external image links are often blocked by email clients like Outlook and Gmail.
Encode binary payloads for JSON REST APIs, transmit files over text-based protocols, and inspect Base64-encoded auth tokens.
Quickly generate inline SVG or image data URIs for Figma prototypes and design systems without needing separate asset hosting.
Analyze Base64-encoded payloads in HTTP headers, JWT tokens, and encoded scripts during security audits and penetration testing.
Understand how Base64 encoding works hands-on — great for computer science courses and web development bootcamps.
Everything you need to know about Base64 encoding and decoding online.
If you have worked with web development, REST APIs, or data transmission, you have almost certainly encountered Base64 encoding. It is one of the most widely used encoding schemes on the internet — used in everything from embedding images in CSS to decoding JWT authentication tokens.
This guide explains what Base64 changes, where standard and URL-safe forms differ, how local file data URIs behave, and which boundaries a converter cannot provide.
Base64 is a binary-to-text encoding scheme. It converts binary data — bytes that may include any value from 0 to 255 — into a string of printable ASCII characters. The "64" in Base64 refers to the 64 characters used: A–Z, a–z, 0–9, plus (+), and slash (/).
The reason Base64 exists is simple: many text-based systems cannot handle raw binary data. Email protocols, HTTP headers, JSON payloads, and XML files were all designed to carry 7-bit ASCII text. When you need to include binary content — like an image, a PDF, or a compiled file — in one of these systems, you need to convert it to safe text first. That is exactly what Base64 encoding does.
💡 Base64 is encoding, not encryption. It is easily reversible by anyone. Never use it to protect sensitive data like passwords or API keys.
The encoding process takes three bytes (24 bits) of binary data at a time and converts them into four Base64 characters (each representing 6 bits). Here is the step-by-step process:
For example, the ASCII string "Hello, World!" encodes to:
One of the most practical uses for web developers is embedding small images directly in HTML or CSS as Base64 data URIs. Instead of linking to an external file, you include the image inline:
Inlining avoids a separate resource request, but it also increases the transferred page or stylesheet size. Compare the encoded result with the delivery requirements of the page instead of relying on a fixed universal threshold.
SMTP — the protocol that powers email — was designed for 7-bit ASCII text. Binary attachments like PDFs, images, and Word documents cannot be sent directly. The MIME standard uses Base64 to encode these attachments into ASCII text for transmission. Your email client (Gmail, Outlook, Apple Mail) automatically decodes them on the receiving end.
JSON is a text format. When a REST API needs to return binary data — like a generated PDF, a thumbnail image, or audio data — the server encodes it as Base64 and includes it in the JSON response. The client then decodes it to get the original binary file.
If you have worked with authentication in modern web apps, you have used Base64 without knowing it. JWT (JSON Web Tokens) are three Base64URL-encoded sections separated by dots: the header, payload, and signature. Paste any JWT into the decoder above to read its contents.
HTTP Basic Authentication sends credentials in the Authorization header as Base64-encoded
username:password. For example, username "admin" and password "secret" becomes:
Authorization: Basic YWRtaW46c2VjcmV0. Note this is NOT secure — use HTTPS
always.
Some database systems and ORMs store binary blobs as Base64 strings in text columns. This simplifies queries and avoids binary handling issues — though it does increase storage size by 33%.
Service account keys, SSL certificates, and API credentials are often Base64-encoded for inclusion in environment variables and config files — since these text formats cannot handle newlines or binary characters in raw form.
Standard Base64 uses + and / characters, which have special meaning in URLs (+ means space, / separates path segments). This causes problems when Base64 strings appear in query parameters or URL path segments.
Base64URL solves this by replacing + with - and / with _. It also omits the padding = signs. JWT tokens use Base64URL encoding for this reason. If you are decoding a JWT or URL-safe Base64 string on Toolyfi, replace - with + and _ with / before decoding.
data:image/png;base64,...
💡 For CSS: background-image: url('data:image/png;base64,...'); |
For HTML: <img src="data:image/png;base64,...">
For developers comfortable with the terminal, base64 command-line tools work
great. But online tools like Toolyfi offer several advantages: no installation required,
visual image preview when decoding, drag-and-drop file support, and one-click copy. They are
especially useful for quick checks, debugging, and sharing with team members who are not
comfortable with command-line tools.
Toolyfi's Base64 encoder and decoder runs entirely in your browser using JavaScript's
built-in btoa() and atob() functions, plus the FileReader API for
file and image uploads.
The conversion functions use browser APIs on the current device. Do not paste secrets or sensitive records into a troubleshooting workflow; Base64 itself does not provide confidentiality.
Base64 is useful in web development, backend engineering, and API integration when a system expects an ASCII-safe representation of bytes. This tool offers a focused browser workspace for examining text, Base64URL values, and local file data URIs.
Try it now — paste any text or upload any image above and see the Base64 result in milliseconds. No account needed, ever.
A Base64 converter is useful because it changes representation, not because it protects information. The browser tool above can encode ordinary UTF-8 text, turn a local file into a data URI, and decode a Base64 or Base64URL value into readable text when that is the value’s actual content. It performs those operations in the page on your device. That local workflow is convenient for a focused technical task, but it should not be confused with encryption, file validation, malware scanning, or a permanent storage service.
Before pasting a value, decide what you expect it to represent. A short Base64 string may be plain text, a JSON document, a Base64URL fragment, or binary data such as an image. A long string may be a file payload. If it is a JSON web token, its header and payload can be decoded for inspection, but the signature is not decoded as readable text and decoding it does not prove that the token is trusted, current, or safe to use.
Web pages work with Unicode text, while Base64 operates on bytes. A converter that only uses
an ASCII shortcut can fail on names, accents, Urdu, Arabic, Chinese, or emoji. Toolyfi first
converts text with UTF-8 so that characters such as café, €, and
👋 can make a normal encode–decode round trip. This does not mean every
external system will interpret the decoded bytes in the same character set; when an API
specifies a charset, follow that API’s documentation.
For a simple check, type a short line containing the characters you actually need, click Encode, then paste the result back into the input and click Decode. Compare the result character by character. This small round-trip test is more reliable than assuming that an encoded value is correct because it “looks like Base64.”
Standard Base64 uses + and /, with optional = padding
at the end. Base64URL is a related form intended for URL and filename contexts: it
substitutes - for + and _ for /, and
many implementations omit trailing padding. The decoder above accepts those URL-safe
characters, restores required padding, and then decodes the result as UTF-8 when possible.
Do not convert a value to Base64URL unless the receiving system asks for it. A standard Base64 string in an API request and a Base64URL string inside a token are not interchangeable merely because both use a similar alphabet. Keep the original specification close to the code or configuration that consumes the value.
When you select a local file, the tool reads it in the browser and creates a data URI. A
data URI contains both a media type and Base64 data, such as
data:image/png;base64,.... This format is useful when a small asset truly needs
to travel inside an HTML document, stylesheet, JSON payload, test fixture, or API field. The
output can be copied as a full data URI or, if an integration asks for it, as the Base64
part after the comma.
Inlining has a cost. Base64 generally adds roughly one third to the raw byte count, and embedding a large image makes an HTML or CSS file harder to cache, inspect, and update. Use small, stable assets only when the surrounding delivery mechanism benefits from it. For ordinary website images, a separately optimized file is often simpler. Toolyfi’s Image Compressor and Image Resizer can help prepare those files before you decide how to deliver them.
Base64 decoding reconstructs bytes. It does not automatically identify every file type, guarantee that the content is safe, or make a binary file readable as text. If a value is an image data URI, the page can show an image preview in the browser. If it is text, it appears in the output. If it represents a binary file, download or inspection decisions should be made carefully and only with content from a source you trust.
Never treat Base64 as a security boundary. Anyone who receives an encoded secret can decode it. Keep credentials, private keys, personal records, access tokens, and production configuration out of screenshots, chat messages, shared links, or public paste sites.
A JSON Web Token commonly has three dot-separated segments: a header, a payload, and a signature. The first two segments are usually Base64URL-encoded JSON. Decoding them can help a developer identify fields such as an expiry timestamp, issuer, audience, or role while debugging a local application. It does not verify the signature, it does not authenticate the holder, and it does not establish that a token’s claims are true.
For a safe inspection workflow, work with a redacted test token whenever possible. Read the fields, check the expected issuer and audience in your application configuration, and use the server-side library for signature validation. If you find a real production token in a log or message, treat it as sensitive and follow your organisation’s incident process rather than pasting it into a browser tool.
Remove surrounding quotes, labels such as base64:, and whitespace that is not
part of the value. If the string is URL-safe, use the - and _ form
directly; the tool normalises it before decoding. If the value includes a data URI prefix,
keep it intact or remove everything through the first comma. A value copied from a wrapped
email message may also have line breaks that need to be removed.
The bytes may not be UTF-8 text. They could be a file, an image, compressed data, encrypted data, or text encoded in a different character set. Confirm the source format before guessing. Base64 is only one layer of a data format; decoding it correctly does not tell you what the underlying bytes mean.
Check the original file size and choose a more appropriate delivery method. A compressed or resized image may be suitable, while a document or video should normally stay as a file. If the receiving field has a documented size limit, use that limit rather than an arbitrary guideline.
For an API test, encode a known small text fixture, send it only to an approved test endpoint, and decode the returned payload to confirm the expected round trip. For an HTML prototype, encode a small icon as a data URI, paste it into the exact attribute or CSS property that will consume it, and check the rendered output in the HTML Preview Tool. For structured data, use the JSON Formatter before copying a Base64 field into JSON so that missing commas or quotation marks do not hide the real problem.
For text clean-up, use the Text Trimmer to remove accidental spaces and line breaks before encoding, or the Case Converter when a value’s surrounding identifier needs a consistent case style. These utilities solve different problems: Base64 changes bytes into an ASCII-safe representation; it does not trim text, validate JSON, compress a file, or encrypt a secret.
Base64 is a dependable transport encoding when you use the expected variant, preserve character encoding, and understand the cost of converting bytes to text. Toolyfi provides a quick browser-side workspace for text, Base64URL, local file data URIs, and simple image previews. Use it to make a specific conversion easy to inspect, then test the final value in the system that will actually consume it.
When a Base64 value is part of a bug report or a handoff, include only the minimum reproducible sample. State whether the value is standard Base64 or Base64URL, whether it has a data URI prefix, and what the recipient should expect after decoding. If the example is an image, include its original file type and dimensions. If it is text, include the intended character set. These details prevent a reviewer from spending time guessing at a representation problem.
Keep encoded values out of commit messages, issue titles, screenshots, and public chat rooms when they contain information that should remain private. Encoding can make a value less readable at a glance, but it does not reduce its sensitivity. Use redacted fixtures for documentation and test data, and use the secure secret-management path approved by the project for real credentials.
Do not choose Base64 because it seems like a shortcut for file hosting, access control, compression, or encryption. It makes files larger, has no built-in integrity check, and anyone can reverse it. A separately served image can be cached; a compressed archive can reduce size; a cryptographic hash can detect changes; and authenticated encryption can protect confidentiality. The correct choice depends on the system’s real requirement, not on what is easiest to paste into one text field.
Use this page for clear, local conversion work and use the receiving platform’s documentation for the final format. That approach keeps technical samples understandable, avoids accidental exposure of information, and makes a Base64 value easier to maintain over time.
Encoding is most useful when the original file, text, and purpose remain clear. Retain the source asset or source string in its appropriate project location rather than treating the Base64 output as the only copy. Name any generated values clearly, record the expected media type, and avoid hand-editing long encoded strings. When a value fails later, compare it with a newly generated result from the original source. This simple practice makes troubleshooting faster and reduces the risk of silently corrupting a payload while it is moved between a browser, a code editor, and an API client.
Use the Toolyfi directory to move from a Base64 conversion to the next focused formatting, preview, or text-preparation task.
Explore all tools