Description
Calculate Base64 tail-byte remainder, written padding count and unused pad-bit count.
A positional encoding separates numeric digit values, alphabet symbols and final-block padding. An alphabet lookup is not a whole-stream codec, and character count can differ from the number of source bytes represented.
Calculate Base64 tail-byte remainder, written padding count and unused pad-bit count.
When to use this tool
Use Base64 Tail Pad Bit Count when checking one alphabet mapping or bounded encoding-padding term.
How to use the tool and how it works
- Enter inputBytes. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read remainderBytes, paddingCharacters, unusedBits. Use the output convention below.
Require nonnegative whole inputBytes. remainderBytes = inputBytes modulo 3; paddingCharacters is zero for remainder zero and otherwise 3-remainder; unusedBits is four for one remainder byte, two for two, otherwise zero.1
Alphabet, tail pad bits and written padding depend on the selected base encoding. This tool handles only its stated local component.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| inputBytes | Input Bytes | Required. Safe integer; minimum 0. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| remainderBytes | Remainder Bytes | Required. Safe integer. |
| paddingCharacters | Padding Characters | Required. Safe integer. |
| unusedBits | Base64 zero pad-bit count in the last symbol, distinct from equals-sign count. | Required. Safe integer. |
{
"input": {
"inputBytes": 4
},
"output": {
"remainderBytes": 1,
"paddingCharacters": 2,
"unusedBits": 4
}
} Limitations and assumptions
- This describes padded Base64 tail structure and canonical zero pad bits, not actual byte encoding or validation of an existing encoded string.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Use the complete codec matching the intended alphabet and padding policy for real payloads and interoperability checks.
References
-
Calculation and input contract: encode/base64-tail-pad-bit-count — tool.io
-
Base16, Base32 and Base64: RFC 4648 — Internet Engineering Task Force
Similar or alternative tools
- Encoding: Base64 Pad Character Count
padCharacters = (3-byteCount modulo 3) modulo 3; encodedLength = 4*ceil(byteCount/3).
- Encoding: Base32 Pad Character Count
padCharacters is [0,6,4,3,1][byteCount modulo 5]; encodedLength = 8*ceil(byteCount/5).