{"success":true,"version":"v1","request":{"tool":"get_calculator_schema","calculator_id":"base64-size"},"result":{"entity_type":"calculator","id":"base64-size","calculator_id":"base64-size","canonical_url":"https://tttkmbb.com/developer/base64-size","name":"Base64 Size Calculator","title":"Base64 Size Calculator – Encoded Length, Padding and Overhead of Base64 and Data URIs","category":"developer","category_name":"Developer & IT","tool_name":"calculate_base64_size","featured_mcp_tool":false,"description":"Computes the length of the Base64 encoding of a given number of bytes (4 characters per 3 bytes, padded with =), the 33 % overhead, the size with MIME/PEM line breaks and the length of a data: URI.","use_when":"You need to know how large a file becomes when embedded as Base64 in JSON, email (MIME) or a data URI, or how many bytes a Base64 string decodes to.","do_not_use_when":"You need to actually encode or decode data, or you are sizing Base32/Base16 output (8 characters per 5 bytes, 2 per byte).","inputs":[{"name":"size_bytes","label":"Raw size","type":"integer","unit":"bytes","required":true,"min":0,"max":1000000000000000,"description":"Number of bytes before encoding.","example":1000000},{"name":"line_length","label":"Line length","type":"integer","unit":"characters","required":false,"default":0,"min":0,"max":1000,"description":"Characters per line when the output is wrapped (76 for MIME per RFC 2045, 64 for PEM); 0 = single line without breaks.","example":76},{"name":"mime_type","label":"MIME type for the data URI","type":"string","required":false,"default":"image/png","description":"Media type written into the data: URI prefix (data:<mime>;base64,).","example":"image/png"}],"outputs":[{"name":"encoded_characters","label":"Encoded length","type":"integer","unit":"characters","decimals":0,"description":"4 × ceil(size_bytes / 3) characters including padding."},{"name":"padding_characters","label":"Padding characters","type":"integer","decimals":0,"description":"Number of trailing = characters (0, 1 or 2)."},{"name":"overhead_percent","label":"Overhead","type":"number","unit":"%","decimals":2,"description":"(encoded − raw) / raw × 100; tends to 33.33 % for large inputs."},{"name":"encoded_with_line_breaks","label":"Length with line breaks","type":"integer","unit":"characters","decimals":0,"description":"Encoded length plus a CRLF (2 characters) after every line of line_length characters; equals encoded_characters when line_length = 0."},{"name":"line_count","label":"Lines","type":"integer","decimals":0,"description":"Number of lines when wrapped (1 when not wrapped)."},{"name":"data_uri_characters","label":"Data URI length","type":"integer","unit":"characters","decimals":0,"description":"Length of data:<mime_type>;base64,<encoded> (no line breaks)."},{"name":"data_uri_prefix","label":"Data URI prefix","type":"string","decimals":4,"description":"The prefix that precedes the Base64 payload."},{"name":"decoded_from_encoded","label":"Decoding check","type":"string","decimals":4,"description":"How to recover the byte count from an encoded length: 3 × encoded / 4 − padding."}],"input_schema":{"type":"object","properties":{"size_bytes":{"description":"Number of bytes before encoding. Unit: bytes.","type":"integer","minimum":0,"maximum":1000000000000000,"examples":[1000000],"x-unit":"bytes"},"line_length":{"description":"Characters per line when the output is wrapped (76 for MIME per RFC 2045, 64 for PEM); 0 = single line without breaks. Unit: characters.","type":"integer","minimum":0,"maximum":1000,"default":0,"examples":[76],"x-unit":"characters"},"mime_type":{"description":"Media type written into the data: URI prefix (data:<mime>;base64,).","type":"string","default":"image/png","examples":["image/png"]}},"additionalProperties":false,"required":["size_bytes"]},"output_schema":{"type":"object","properties":{"encoded_characters":{"description":"4 × ceil(size_bytes / 3) characters including padding. Unit: characters.","type":"integer","x-unit":"characters"},"padding_characters":{"description":"Number of trailing = characters (0, 1 or 2).","type":"integer"},"overhead_percent":{"description":"(encoded − raw) / raw × 100; tends to 33.33 % for large inputs. Unit: %.","type":"number","x-unit":"%"},"encoded_with_line_breaks":{"description":"Encoded length plus a CRLF (2 characters) after every line of line_length characters; equals encoded_characters when line_length = 0. Unit: characters.","type":"integer","x-unit":"characters"},"line_count":{"description":"Number of lines when wrapped (1 when not wrapped).","type":"integer"},"data_uri_characters":{"description":"Length of data:<mime_type>;base64,<encoded> (no line breaks). Unit: characters.","type":"integer","x-unit":"characters"},"data_uri_prefix":{"description":"The prefix that precedes the Base64 payload.","type":"string"},"decoded_from_encoded":{"description":"How to recover the byte count from an encoded length: 3 × encoded / 4 − padding.","type":"string"}}},"formula":"encoded = 4 × ceil(size_bytes / 3); padding = (3 − size_bytes mod 3) mod 3; lines = ceil(encoded / line_length); with_breaks = encoded + 2 × lines; data_uri = encoded + length('data:' + mime_type + ';base64,')","method":"RFC 4648 section 4 Base64 with = padding; MIME (RFC 2045) wraps at 76 characters with CRLF line endings, PEM at 64. Unpadded variants (base64url in JWTs) are shorter by padding_characters.","sources":[{"name":"RFC 4648 – The Base16, Base32, and Base64 Data Encodings","url":"https://www.rfc-editor.org/rfc/rfc4648","type":"standard","retrieved_at":"2026-09-24"},{"name":"RFC 2045 – MIME Part One: Format of Internet Message Bodies (section 6.8, Base64 with 76-character lines)","url":"https://www.rfc-editor.org/rfc/rfc2045","type":"standard","retrieved_at":"2026-09-24"}],"freshness":{"type":"static","max_age_seconds":null,"note":"Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output."},"examples":[{"name":"3 bytes","inputs":{"size_bytes":3,"line_length":0},"expected":{"encoded_characters":4,"padding_characters":0,"overhead_percent":33.33,"encoded_with_line_breaks":4,"data_uri_characters":26},"url":"https://tttkmbb.com/api/v1/calculate/base64-size?size_bytes=3&line_length=0"},{"name":"1,000,000 bytes with MIME line breaks","inputs":{"size_bytes":1000000,"line_length":76},"expected":{"encoded_characters":1333336,"padding_characters":2,"overhead_percent":33.33,"line_count":17544,"encoded_with_line_breaks":1368424,"decoded_from_encoded":"3 × 1333336 / 4 − 2 padding = 1000000 bytes"},"url":"https://tttkmbb.com/api/v1/calculate/base64-size?size_bytes=1000000&line_length=76"}],"faq":[{"q":"Why is Base64 33 % larger?","a":"Every 6 bits of input become one 8-bit ASCII character, so 3 bytes turn into 4 characters (4/3 = 1.333); padding adds up to 2 more characters at the end."},{"q":"How many bytes does a Base64 string of length L decode to?","a":"3 × L / 4 minus the number of trailing = characters (L must be a multiple of 4 when padded)."},{"q":"Does gzip undo the overhead?","a":"Partly: Base64 text compresses to roughly the size of the compressed original plus a few percent, but only if the transport compresses it (e.g. HTTP content-encoding)."}],"tags":["base64 size","base64 length","base64 overhead","data uri size","encoded size calculator"],"related":[{"calculator_id":"data-storage","reason":"Convert the resulting byte counts between KB, MiB and other units."},{"calculator_id":"download-time","reason":"Transfer time of the encoded payload."},{"calculator_id":"text-hash","reason":"Digest of the same data."}],"links":{"html":"https://tttkmbb.com/developer/base64-size","markdown":"https://tttkmbb.com/developer/base64-size.md","json":"https://tttkmbb.com/developer/base64-size.json","api":"https://tttkmbb.com/api/v1/calculate/base64-size","schema":"https://tttkmbb.com/api/v1/calculators/base64-size","openapi":"https://tttkmbb.com/openapi.json","mcp":"https://tttkmbb.com/mcp"},"version":"v1","updated_at":"2026-09-24"},"timestamp":"2026-09-24T03:44:11Z"}