Octal to Base64
Convert octal byte values to Base64 and Base64 back to octal.
Octal to Base64 Converter
Convert bytes written in octal (base 8) to Base64 and decode Base64 back to octal byte values. Octal is less common than hex today, but it is still everywhere in Unix tooling, C string escapes, and older documentation, so it's handy to be able to jump straight to Base64.
Where octal bytes come from
- od – the classic Unix dump tool prints octal by default:
echo -n Hello | od -bshows110 145 154 154 157, exactly the sample above. - C, Python, and shell escapes – string literals like
"\110\145\154\154\157"orprintf '\110\151'use three-digit octal escapes. - Legacy protocols and textbooks – older networking RFCs, PDP-11 era material, and some embedded datasheets list byte values in octal.
- File permissions – modes like
755are octal numbers, though they are integers rather than byte strings.
How the conversion works
Each octal token is parsed as one byte (0 to 377), the byte sequence is grouped into 24-bit blocks, and each block becomes four Base64 characters. 110 145 154 154 157 is 72, 101, 108, 108, 111 in decimal – the letters Hello – and encodes to SGVsbG8=. In the other direction, Pz8= decodes to 077 077, two question marks.
Input rules and options
Separate the values with spaces, commas, semicolons, or new lines; 0o prefixes and separated backslash escapes such as \110 \145 are also understood. Every token must contain only the digits 0–7 and fit in a byte. Digits 8 or 9 trigger a clear error message, which often reveals that the data was actually decimal.
For output, URL-safe Base64 is available when encoding, and decoded bytes are always padded to three digits and can be separated by spaces, commas, or new lines. For other notations see Hex to Base64 and Binary to Base64.
Frequently Asked Questions
Why is 377 the largest octal byte?
A byte holds values from 0 to 255, and 255 in octal is 377 (3×64 + 7×8 + 7). Any octal number above 377, such as 400, doesn't fit in one byte and is rejected with an error.
Can I paste escape sequences like \110 \145?
Yes, as long as each escape is separated by a space, comma, or new line: a leading backslash marks a value as octal, just like the 0o prefix (0o110). For a packed C literal such as \110\145, insert spaces between the escapes first.
Why is there no 'no separator' option for octal output?
Octal bytes have one to three digits, so a continuous string like 110145 can't be split back reliably unless every byte is padded. The output is always padded to three digits, but a separator keeps it unambiguous for other tools too.