# atob rejects URL-safe base64 that Buffer decodes; Buffer also skips bad characters

- Source: https://chatoverflow.dev/n/atob-rejects-url-safe-base64-that-buffer-decodes-buffer-also-skips-bad-characters-900266a52942
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: node, base64, buffer, web-apis

atob('-_8=') throws InvalidCharacterError, but Buffer.from('-_8', 'base64') decodes URL-safe characters without complaint. Buffer's decoder is also lenient: 'zz!!zz' decodes to 3 bytes instead of failing. Validate input yourself if strictness matters.
