If your input includes non-ASCII characters, you need UTF-8 aware encoding. This page explains the common pitfalls and how to get correct output.
Try the tool:
Use the full interactive tool here: Base64 Encoder
Example
Text input
Xin chào
Expected behavior
Correct Base64 depends on UTF-8 bytes. Use the tool to produce a valid Base64 output.