I've read following topic and found this formula there:
length = 4*(n/3)
I started to test it:
1 symbol:
Base64.getEncoder().encodeToString("1".getBytes())
=>MQ==
(4 symbols)
2 symbols:
Base64.getEncoder().encodeToString("12".getBytes())
=>MTI=
(4 symbols)
5 symbols:
Base64.getEncoder().encodeToString("12345".getBytes())
=>MTIzNDU=
(8 symbols)
8 symbols:
Base64.getEncoder().encodeToString("12345678".getBytes())
=>MTIzNDU2Nzg=
(12 symbols)
21symbols:
Base64.getEncoder().encodeToString("123456789012345678901".getBytes())
=> MTIzNDU2Nzg5MDEyMzQ1Njc4OTAx
(28 symbols)
Looks like this formula doesn't work.
Can you please explain mu results?