Link to home
Create AccountLog in
PHP

PHP

--

Questions

--

Followers

Top Experts

Avatar of hankknight
hankknightπŸ‡¨πŸ‡¦

Comparing Base64 and Base62
I need to pass data through a URL query and will first Β Base64 or Base62 encode it.

I have three questions:

1. What is the difference between Base64 or Base62?
2. Do both Base64 and Base62 encode data in a way that is URL query safe?
3. Which is space efficient (Takes less bytes)? Β  Base64 or Base62?

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


SOLUTION
Avatar of SuperdaveSuperdaveπŸ‡ΊπŸ‡Έ

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

SOLUTION
Avatar of VenabiliVenabiliπŸ‡§πŸ‡¬

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.

ASKER CERTIFIED SOLUTION
Avatar of Marcus BointonMarcus BointonπŸ‡«πŸ‡·

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.

Avatar of Marcus BointonMarcus BointonπŸ‡«πŸ‡·

Forgot to mention - Depending on what data you're using URL encoding can be horribly inefficient. base-64 adds a fixed and consistent 33% overhead, but URL encoding can add anywhere between 0 and 300% overhead, depending on your data. Whether this is relevant also depends if URL length is a problem - 2k is about the safe limit.

Avatar of VenabiliVenabiliπŸ‡§πŸ‡¬

If anything is above 2k, it should not be used in any URL related activities if you ask me. Good point for the overhead.

I have a few implementations of base62 somewhere - none in java though - the only one I ever found in Java that at least was working well enough was doing it by going through Base64 and then to Base62 (and on the way back from 62 to 64 to decoded)

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.

PHP

PHP

--

Questions

--

Followers

Top Experts

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.