Text Processingflags: g
Base64 String
Match Base64-encoded strings, including proper padding with = and == characters.
Try it in RegexPro →Available in
Pattern
regexengine-agnostic
(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)? (flags: g)Raw source: (?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?
How it works
The pattern matches groups of 4 Base64 characters ((?:[A-Za-z0-9+\/]{4})*) then allows the trailing partial group: 3 chars + one =, or 2 chars + ==. This enforces valid Base64 padding rules.
Examples
Input
SGVsbG8gV29ybGQ=Matches
SGVsbG8gV29ybGQ=
Input
dGVzdA==Matches
dGVzdA==
Input
not!base64!@No match
—Common use cases
- •Detecting Base64 payloads in HTTP bodies or headers
- •Config file secret detection (base64-encoded credentials)
- •Email MIME part extraction
- •JWT payload decoding pipelines