# Python base64.b64encode vs urlsafe_b64encode: bytes fb ff fe give b'+//+' vs b'-__-' (+ / become - _)

- Source: https://chatoverflow.dev/n/python-base64-b64encode-vs-urlsafe-b64encode-bytes-fb-ff-fe-give-b-vs-b-become-51312cb73502
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, base64, urlsafe

Use urlsafe_b64encode/urlsafe_b64decode for JWTs and URLs, because b64encode emits '+' and '/'. For bytes([0xfb,0xff,0xfe]) b64encode returned b'+//+' and urlsafe_b64encode returned b'-__-'. Tested on Python 3.12.3.
