Mutual encoder (Base64/URL encoding/Hex compatible) | ZeroTools

A browser-based tool that instantly converts input text into standard Base64, URL percent-encoding, hexadecimal, or binary representations, and decodes them back to UTF-8 strings. It processes your input locally as you type, providing real-time conversion results for API debugging, data inspection, and text format verification.

Loading tool interface...

When to use this tool

Back to the tool ↑

Convert UTF-8 text between Base64, URL encoding, hexadecimal, and binary.

Try it first

Enter Hello, encode as Base64 to get SGVsbG8=, and decode to verify the round trip.

Before you start

Local file input produces a Base64 data URL. The output is an encoding and provides no confidentiality or integrity check.

Local Execution Notice

This conversion logic runs locally within your browser using JavaScript APIs. While your input string is not uploaded to an external server for processing, please note that the website's standard hosting assets, analytics, or advertisements may still communicate with their respective servers.

ZeroTools: Browser Processing & Privacy

ZeroTools focuses on tools that process input on your device. Check each tool’s scope and limitations before use.

Processing and privacy policy
Chapter 1

Supported Conversion Methods and Basic Operations

This mutual encoder is a browser-based utility specifically designed to convert input strings into standard Base64, URL percent-encoding, hexadecimal, or binary formats, and to decode those formats back into UTF-8 strings.

The interface focuses on a straightforward, single-directional flow: you provide the input text, select whether you want to encode or decode, choose one of the four supported methods from the dropdown menu, and read the resulting output from the dedicated result area.

The tool processes the text in real-time as you type, evaluating every keystroke and updating the output instantly without requiring you to press a separate submission button.

Because it displays only one method's conversion result at a time, you must deliberately select the specific format you need rather than seeing all four formats simultaneously.

The output field is read-only to prevent accidental modification of the converted result, and it includes a convenient copy button to quickly transfer the text to your operating system's clipboard.

You can also use the swap button, which moves the current output text back into the input field and reverses the conversion direction.

This swapping action is particularly useful when you want to verify that an encoded string can be successfully decoded back to its original state without data loss.

Note that this tool does not support HTML entity reference conversion, Unicode escape sequences, Base64URL format, or automatic character encoding detection.

None of the four available methods provide cryptographic encryption, and the tool does not evaluate the security of your input or sanitize malicious HTML payloads.

It is strictly a format conversion utility meant for development and debugging purposes.

Chapter 2

Understanding UTF-8 and Standard Base64 Conversion

When you choose to encode normal text into Base64, the tool first utilizes the native JavaScript TextEncoder API to convert your string into a sequence of UTF-8 bytes.

Because standard ASCII characters typically occupy one byte of memory, while many symbols, Japanese characters, and emojis take up two to four bytes, the visible character count of your input does not directly match the underlying byte length that is processed.

Each resulting byte is then mapped to its character equivalent and passed to the built-in base-64 encoding function to produce a standard Base64 string.

The Base64 algorithm represents data by taking every 24 bits, which is exactly three bytes, and dividing them into four 6-bit groups.

Each of these 6-bit groups is then mapped to a specific 64-character alphabet consisting of uppercase letters, lowercase letters, numbers, plus signs, and forward slashes.

If the original byte length is not an exact multiple of three, the tool appends one or two equal signs as padding at the end of the output string.

For example, encoding the word cat produces Y2F0, while encoding the word cats produces Y2F0cw==. This padding ensures the data structure remains mathematically intact when reversing the process.

During decoding, the Base64 string is converted back into a byte array, which the TextDecoder then interprets as a UTF-8 string. If the input contains invalid Base64 characters or if the decoded bytes do not form valid UTF-8 sequences, the tool will either throw an error or display replacement characters instead of recovering the exact original text.

The tool handles strictly standard Base64, not the URL-safe variant that replaces the plus and slash characters with hyphens and underscores.

Chapter 3

URL Percent-Encoding Behavior and Limitations

The URL conversion mode utilizes the built-in JavaScript functions for encoding and decoding URI components. When you encode text in this mode, it converts spaces, international characters, and reserved URL syntax symbols into a strict sequence consisting of a percent sign followed by two uppercase hexadecimal digits corresponding to each underlying UTF-8 byte.

For example, encoding the at symbol @ results in %40, and encoding a single space results in %20. However, you must be aware that certain characters such as hyphens, underscores, periods, exclamation marks, tildes, asterisks, apostrophes, and parentheses are intentionally left unescaped by this specific JavaScript function.

You should also understand that this tool does not implement the specific application form-urlencoded rule that converts spaces into plus signs, nor does it replicate the exact serialization rules used by modern URL search parameters.

Because the tool treats your entire input block as a single, continuous component, pasting a complete, valid URL will result in the protocol colons, path slashes, and query question marks being percent-encoded as well.

Therefore, this mode is best used for encoding specific query values, individual parameters, or path segments rather than attempting to encode entire web addresses at once.

When switching to decode mode, the tool expects valid percent-encoded UTF-8 byte sequences. Providing incomplete percent sequences, such as a percent sign followed by only one valid digit, or invalid byte representations will cause a fatal conversion error, which immediately clears the output area and displays a warning message.

Chapter 4

Hexadecimal and Binary Byte Representation

The hexadecimal conversion mode takes each UTF-8 byte of your input text and converts it into a two-digit lowercase hex value, concatenating them without any spaces or separators.

For example, the capital letter A, which is represented as hex 41 in ASCII, will output simply as 41. Characters that require multiple bytes in UTF-8 encoding will produce a continuous sequence of multiple two-digit hex pairs.

When you switch to decoding from hexadecimal, the tool first strips away any characters from your input that are not valid hex digits, meaning that spaces, line breaks, or punctuation marks are completely ignored.

However, the remaining cleaned sequence must have an exactly even number of characters. An odd length indicates an incomplete byte definition and will trigger a conversion error.

The binary mode operates on a very similar principle but converts each UTF-8 byte into an eight-digit sequence of zeros and ones, separating each complete byte with a single space for readability.

The capital letter A becomes 01000001. During binary decoding, the tool aggressively removes all characters except zeros and ones, and then verifies that the total length of the remaining binary sequence is an exact multiple of eight.

Both of these modes display the UTF-8 byte representation, not the raw Unicode code points. The tool does not automatically normalize your input to NFC or NFD forms, so visually identical characters that are composed differently might produce entirely different hex or binary outputs depending on their underlying byte composition.

Chapter 5

File Loading Mechanism

This system includes an auxiliary file loading feature that is intended exclusively for the encoding side of the process. When you select a file via the browser dialog or drag and drop a file directly into the input text area, the tool reads it using the FileReader API to extract its Data URL representation.

The interface automatically switches to the encode mode and selects the Base64 format. A placeholder string indicating the file name and its calculated size in kilobytes is inserted into the input text area, while the actual Data URL, which starts with the scheme, MIME type, and base64 declaration followed by the encoded content, is placed directly into the output area.

The placeholder prefix matches the prefix checked by the real-time conversion effect, ensuring that updating the input does not re-encode the label and overwrite the loaded Data URL.

This mechanism serves specifically to provide the Data URL output without offering binary file saving or general Data URL decoding.

Chapter 6

Practical Usage and Error Interpretation Guidelines

These string format conversions are highly practical for verifying API responses, inspecting URL query values, and observing the underlying UTF-8 byte structure of complex text strings during development.

When debugging data payloads, you can easily toggle between hexadecimal and binary modes to see different mathematical representations of the same input string, helping you deeply understand how data is serialized at the byte level before transmission.

However, the tool does not guarantee that the resulting string will perfectly meet the specific formatting requirements of all external systems, which might strictly expect Base64URL encoding without padding, completely different character set encodings like Shift-JIS or Windows-1252, or custom byte delimiters such as colons in MAC addresses.

If the tool encounters invalid Base64 padding, malformed URI percent sequences, odd-length hexadecimal inputs, or incomplete binary octets during the decoding phase, it will clear the result area and display an explicit error message explaining the specific conversion failure.

Conversely, because the hex and binary decoders aggressively strip invalid characters before attempting conversion, they will not warn you about typos involving stray letters or symbols; they will simply decode whatever valid digits happen to remain in the string.

You should never use this tool to process highly sensitive information such as production database passwords, private cryptographic keys, or confidential personal data.

While the text conversion logic runs entirely in your local browser using local JavaScript APIs, the tool does not offer absolute security guarantees or complete offline isolation from standard site communications such as background analytics or hosting assets.

Always verify your converted results by decoding them back to the original text before relying on them in your critical development workflows.

Frequently Asked Questions (FAQ)

A.
No, this tool implements standard Base64 encoding. It does not replace plus and slash characters with hyphens and underscores, which is required for the Base64URL variant.
A.
Hexadecimal decoding first strips non-hex characters and then requires the remaining string to have an even length. An odd length indicates an incomplete byte and causes an error.
A.
Yes. When you load a file, the tool reads it via the FileReader API and outputs its Data URL representation in Base64 format. The placeholder inserted into the input area matches the prefix recognized by the conversion effect, preventing the loaded Data URL from being overwritten by an encoding of the label text.
A.
No, the URL encoding mode uses standard JavaScript component encoding, which converts spaces to %20. It does not apply the specific application/x-www-form-urlencoded rule that uses plus signs.