Join our Newsletter — 33% off our NHI Course
Home› Guides› Binary, Hex and Base64 for Beginners: The Number…
Guide Data Security

Binary, Hex and Base64 for Beginners: The Number Formats Security Tools Show You

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 1 December 2026 11 min read
On this page

Binary, hex and Base64 are different ways of writing the same computer data, and none of them hides it.

This guide is for anyone who has opened a log, a settings file or a security tool and seen long strings of numbers and letters. You do not need maths or code. Being able to recognise these formats helps you spot a secret that only looks scrambled.

In short

  • Computers store everything as bits, which are 0s and 1s, usually grouped in eights called bytes.
  • Hex writes each byte as two characters from 0 to 9 and A to F, which is shorter and easier to read than binary.
  • Base64 turns any data into plain letters, numbers and a few symbols so it can travel through text-only systems.
  • All three are encoding, not encryption: anyone can turn them back, so a Base64 password is still a password.

What you will learn

  • Explain what bits and bytes are.
  • Spot hex and Base64 when you see them in a log or file.
  • Explain why encoded data is not protected data.
  • Check a suspicious string safely with a decoding tool.
On or off (bit)
the smallest piece of computer data, a 0 or a 1.
Group of eight (byte)
eight bits together, which can hold a number from 0 to 255.
Another alphabet (encoding)
writing the same data in a different form so a system can carry it.

What are binary, hex and Base64?

Think of writing a message in a different alphabet. The words do not change, only the letters used to write them. Anyone who knows that alphabet can read the message straight back.

Computers store everything as bits, each a 0 or a 1 [2]. Eight bits make a byte, which can stand for a number from 0 to 255 [3]. Writing data out as 0s and 1s is called binary.

Hex (short for hexadecimal) is a counting system with 16 symbols: 0 to 9, then A to F for 10 to 15 [1]. Each hex character stands for 4 bits, so one byte is two hex characters [1].

Base64 uses 64 characters: capital letters, small letters, digits and two symbols, plus "=" for padding at the end. It turns every 3 bytes into 4 characters [1]. That makes the result roughly a third bigger than the original [4].

Where the comparison stops working: a foreign alphabet can feel like a secret code to someone who does not know it. These formats are public standards, and free tools decode them instantly. They are not secret at all.

For how encoding differs from encryption and hashing, read Encoding, Encryption and Hashing for Beginners. This page shows you how to read the formats themselves.

Why does it matter?

Security tools, logs and settings files often show data in hex or Base64. If you cannot read them, it is easy to mistake a plain password for a protected one.

If you are new to security work

What could happen: you skip a long Base64 string in an alert, but it holds a command or a password.

Check this: decode unknown strings in a safe tool before you decide they are harmless.

Next: CyberChef for Beginners

If you look after servers or cloud settings

What could happen: you treat a Base64 value in a settings file as safe to share, but it is a working secret.

Check this: treat encoded secrets exactly like plain ones.

Next: Encoding, Encryption and Hashing for Beginners

If you manage a technical team

What could happen: a supplier says data is "encoded" and you hear "protected".

Check this: ask whether the data is encrypted, and who holds the key.

Next: Encryption for Beginners

What does it look like?

Here is a made-up settings file for an app's database connection. It shows the same kind of value written three ways.

Example only. All values are made up.

# settings for EXAMPLE billing app
db_host: db.example.invalid
db_user_b64: ZXhhbXBsZS11c2Vy                    (1)
db_password_b64: RkFLRS1wYXNzd29yZC0wMDAw        (2)
api_key_hex: 46414B452D30303030                  (3)
note: "values are encoded for safety"            (4)
  1. Base64 for the made-up user name "example-user".
  2. Base64 for the made-up password "FAKE-password-0000". In a real file, this line would contain the database password, readable by anyone who decodes it.
  3. Hex for "FAKE-0000". Each pair of characters is one byte.
  4. A comment that confuses encoding with protection.

Why this is risky: anyone who can read the file can decode all three values with a free tool. Encoding only makes them harder to read at a glance.

The safer way: keep secrets out of the file and fetch them from a vault, which is a locked store for secrets. Limit who can read the file.

How does it work?

Here is how the word "foo" is written in each format. The values come from the official standard's own test examples [1].

  1. Start with text. The computer stores each letter as a number, using a code table such as ASCII [5].
  2. Write each byte in hex. "foo" becomes 66 6F 6F, two hex characters per letter [1].
  3. See the bits. Hex 66 is 0110 0110 in binary, because each hex character stands for 4 bits.
  4. Regroup for Base64. Base64 takes the same bits 6 at a time and picks one of its 64 characters for each group. "foo" becomes "Zm9v" [1].
  5. Reverse it. Any decoder can run these steps backwards. No key or password is needed.
Diagram titled One word, four ways to write it. Four boxes in a row joined by arrows. Box 1, Text: foo. Box 2, Hex: 66 6F 6F, two characters per byte. Box 3, Binary: 01100110 01101111 01101111, eight bits per byte. Box 4, Base64: Zm9v, four characters for every three bytes. A note underneath says every step can be reversed by anyone, with no key, so encoding is not encryption.
Figure 1. The same three bytes written as text, hex, binary and Base64.

How to tell them apart

  • Binary: only 0s and 1s, often in groups of eight.
  • Hex: only 0 to 9 and A to F, often in pairs. A hex dump, which is a tool's view of a file's raw bytes, shows rows of these pairs.
  • Base64: a mix of capital and small letters, digits, "+" and "/", and often one or two "=" signs at the end [1].

Why attackers use it, and why you should look

Attackers may encode data to make their traffic harder to inspect. A public catalogue of attacker methods lists hex and Base64 among the common encodings they use [6]. Decoding a strange string is often the first step in understanding an alert.

The same mistake happens with software secrets. Kubernetes, a popular system for running apps, stores many secret values in Base64. Its documentation warns that this only obscures them and anyone who can read the secret can learn it [7]. Keys and tokens like these belong to software, so they are non-human identities and need real protection.

A worked example

This story is made up to show the idea.

Bruno Haddad has just joined a small IT team. His first task is to read the overnight alerts. One alert shows a script that ran on a staff laptop, with a long block of letters and numbers ending in "==".

Bruno recognises the "=" padding and the mix of capitals and small letters. He thinks it is Base64. He copies the string into CyberChef. It is a free tool published by the UK's GCHQ, and it does its work inside your own browser [8].

The decoded text is a short instruction to download a file from an unknown web address. Bruno does not run it. He notes the address and passes the alert to his team lead with a short summary.

While he is in the tool, his lead asks him to check a settings file for a billing app. It has a field called "db_password_b64". Bruno decodes it and finds a readable password.

His lead agrees it is a real risk, even though the file says "encoded". The team moves the password into the company's secrets vault and changes it. They also limit who can read the settings file.

Bruno writes one line in the team notes: "Encoded is not encrypted. Decode before you decide."

Myths and mistakes

What people thinkWhat is true
Base64 is a kind of encryption.Base64 is encoding. The standard says it gives no real secrecy, though it can hide things like passwords from a quick glance [1].
Hex is only for programmers.Many security tools show raw data in hex. A little practice makes it easy to spot.
A string ending in "=" must be a password.It is often Base64 padding. It may hold anything: text, an image or a command.
Encoding makes data smaller.Base64 makes data roughly a third bigger [4]. Making data smaller is compression.
Decoding a string is risky for my computer.Decoding only changes how text looks. The risk comes from running what you decoded, so read it and do not run it.

What can I do this week?

  • Open a decoding tool such as CyberChef and turn your first name into hex and Base64, then back again.
  • Look through one settings file you manage for fields ending in "_b64" or values that look like Base64.
  • Treat any encoded secret you find as a plain secret: move it to a vault and change it.
  • Next time a supplier says "encoded", ask whether the data is encrypted and who holds the key.

Checklist

  • I can explain bits and bytes in one sentence each.
  • I can spot hex by its 0 to 9 and A to F characters.
  • I can spot Base64 by its mixed letters, digits and "=" padding.
  • I know that hex and Base64 can be reversed by anyone.
  • I decode suspicious strings before I decide they are harmless.
  • I never run decoded commands just to see what they do.
  • I treat encoded passwords and keys as plain secrets.

Common questions

What is the difference between a bit and a byte?

A bit is a single 0 or 1, the smallest piece of data. A byte is a group of eight bits, which can stand for a number from 0 to 255. File sizes are usually counted in bytes, while network speeds are often given in bits.

Why use hex instead of binary?

Hex is much shorter. One byte takes eight binary digits but only two hex characters. That makes raw data far easier for people to read, compare and copy, which is why many security and debugging tools show it in hex.

Where will I see Base64?

Often in email attachments, web pages that embed images, settings files and logs. It is used wherever binary data must pass through systems built for plain text. Seeing it is normal. What matters is what it decodes to.

Is it safe to paste a string into an online decoder?

Be careful with real secrets or company data. CyberChef says it processes data inside your own browser rather than sending it to its server. For sensitive material, check your organisation's rules first, or use an approved offline tool.

How do I know if something is encrypted rather than encoded?

Try decoding it. If a standard decoder gives readable text or a known file type, it was only encoded. Encrypted data still looks like noise after decoding, and you need the right key to read it.

Where next?

Ready for the detail? Read the practitioner guide: Encoding, Encryption and Hashing. It goes further into when to use each one, how teams choose algorithms, and how to store passwords and keys safely.

Also useful:

Related NHI Mgmt Group resources: Non-Human Identities for Beginners, Encryption for Beginners and Logging and Log Management for Beginners.

Key terms

Bit
The smallest piece of computer data, a 0 or a 1.
Byte
A group of eight bits, which can hold a number from 0 to 255.
Hexadecimal (hex)
A way of writing numbers with 16 symbols, 0 to 9 and A to F, where two characters make one byte.
Base64
An encoding that writes any data using 64 plain characters so it can travel through text-only systems.
Encoding
Changing how data is written so a system can carry it. Anyone can reverse it.
Encryption
Scrambling data so that only someone with the right key can read it.
Hex dump
A view of a file's raw bytes written as rows of hex pairs.

Sources and further reading

  1. S. Josefsson, "The Base16, Base32, and Base64 Data Encodings", RFC 4648, IETF, October 2006. https://www.rfc-editor.org/rfc/rfc4648 (accessed 1 Dec 2026).
  2. NIST Computer Security Resource Center, Glossary, "bit". https://csrc.nist.gov/glossary/term/bit (accessed 1 Dec 2026).
  3. NIST Computer Security Resource Center, Glossary, "byte". https://csrc.nist.gov/glossary/term/byte (accessed 1 Dec 2026).
  4. MDN Web Docs, "Base64", Glossary. https://developer.mozilla.org/en-US/docs/Glossary/Base64 (accessed 1 Dec 2026).
  5. V. Cerf, "ASCII format for Network Interchange", RFC 20, IETF, October 1969. https://www.rfc-editor.org/rfc/rfc20 (accessed 1 Dec 2026).
  6. MITRE ATT&CK, "Data Encoding: Standard Encoding" (T1132.001). https://attack.mitre.org/techniques/T1132/001/ (accessed 1 Dec 2026).
  7. Kubernetes documentation, "Secrets". https://kubernetes.io/docs/concepts/configuration/secret/ (accessed 1 Dec 2026).
  8. GCHQ, "CyberChef" (GitHub repository README). https://github.com/gchq/CyberChef (accessed 1 Dec 2026).

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.