Enter a number to start converting
Base System Reference
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 255 | 11111111 | 377 | FF |
Click to Load
Bitwise Operations Guide
1010 & 1100 = 1000
Both bits must be 1. Used for masking specific bits.
1010 | 1100 = 1110
Either bit is 1. Used for setting bit flags.
1010 ^ 1100 = 0110
Bits must differ. Used for toggling and encryption.
~1010 = 0101
Flips all bits. Inverts the bit pattern.
0011 << 2 = 1100
Shifts left, fills with 0. Multiplies by 2^n.
1100 >> 2 = 0011
Shifts right, discards bits. Divides by 2^n.
What is Number Base Conversion?
Number base conversion is the process of representing a numeric value in different numeral systems. In everyday life, we use the decimal system (base 10) with ten digits from 0 to 9. However, computers and digital systems use different bases such as binary (base 2), octal (base 8), and hexadecimal (base 16) to process and represent data more efficiently.
The decimal system is familiar because each digit represents a multiple of a power of 10. For example, 255 means 2x102 + 5x101 + 5x100. Similarly, in binary, each position represents a power of 2 — the binary number 11111111 equals 255 in decimal (128+64+32+16+8+4+2+1). Understanding how to convert between bases is a foundational skill for any programmer or hardware engineer.
How Binary, Octal, Decimal, and Hex Work
Binary (Base 2) uses only two digits: 0 and 1. This is the fundamental language of every computer because electronic circuits have only two states: off (0) and on (1). Each binary digit is called a bit, and 8 bits form a byte. A single byte can represent 256 different values (0 to 255), enough to store an ASCII character or a single color channel value.
Octal (Base 8) uses digits 0 through 7. This system was once very common in early computing because each octal digit represents exactly 3 binary bits. Today, octal is still used in Unix/Linux file permission systems (for example, chmod 755 sets read, write, and execute permissions for different user groups).
Hexadecimal (Base 16) uses 16 characters: 0-9 and A-F (or a-f). Hex is widely used in programming because it provides a compact representation for binary data — each hex digit represents exactly 4 bits. For example, a byte (8 bits) can be represented by exactly 2 hex digits: FF = 11111111 = 255. CSS color codes like #FF5733 use hex to encode the red (FF), green (57), and blue (33) components of a color.
Base 36 uses all 10 digits and 26 letters (0-9, A-Z), creating the most efficient numeral system for compact strings. It is commonly used to generate short URLs, reference codes, and unique identifiers where string length optimization matters.
Number Systems in Programming
Modern programming languages directly support multiple number bases. In JavaScript, you can write hex numbers with the 0x prefix (e.g., 0xFF), binary with 0b (e.g., 0b1010), and octal with 0o (e.g., 0o17). The parseInt("FF", 16) method converts from any base to decimal, and (255).toString(16) converts from decimal to any base.
In Python, built-in functions bin(), oct(), and hex() convert integers to binary, octal, and hex string representations respectively. The int("FF", 16) function parses strings from any base. Python also supports arbitrary-precision integers, making it ideal for operations with extremely large numbers that would overflow in other languages.
In C and C++, the 0x prefix is used for hex and 0 (zero) for octal. C23 and C++14 onward support the 0b prefix for binary literals. The format specifiers %x, %o, %d in printf output numbers in different bases. Memory management and address debugging frequently require working with hex addresses.
Common Number Base Use Cases
Web Development: CSS color codes use hexadecimal (#RRGGBB), where each hex pair represents a color component from 0 (00) to 255 (FF). Understanding hex conversion helps you quickly tweak colors without a color picker. For example, #808080 is 50% gray because each channel has a value of 128/255.
Networking: IP addresses, MAC addresses, and network protocols are frequently represented in hex or binary. An IPv4 address is 4 bytes (32 bits), and a subnet mask like 255.255.255.0 is easier to understand in binary: 11111111.11111111.11111111.00000000 — clearly showing the boundary between network and host portions.
Cryptography and Security: Hash functions like SHA-256 and MD5 output their results as hex strings. Encryption keys, digital certificates, and security protocols all work with binary data represented in hex for human readability and inspection.
Embedded Systems: Microcontroller programming requires deep understanding of binary to manipulate registers, configure GPIO pins, and communicate via serial protocols. Each bit in a control register can toggle a specific hardware feature on or off.
Binary Arithmetic Basics
Binary addition works just like decimal addition but with only two digits. The basic rules are: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (write 0, carry 1). For example: 1011 + 0110 = 10001 (in decimal: 11 + 6 = 17).
Binary multiplication is simpler than decimal multiplication because you only multiply by 0 or 1. Multiplying by 1 keeps the number, multiplying by 0 gives 0, then you add the partial products. Left-shifting a binary number is equivalent to doubling its value — this is the foundation of fast multiplication in digital signal processing and optimization algorithms.
Negative numbers in binary are typically represented using two's complement. To negate a positive number, invert all bits (one's complement) then add 1. For example, 5 in 8-bit binary is 00000101, the one's complement is 11111010, adding 1 gives 11111011 = -5. This method lets computers perform subtraction by adding the negative number, simplifying the arithmetic logic unit circuitry.
See related tools: Base64 Encoder, Hash Generator, and URL Encoder.
Frequently Asked Questions
You Might Also Like
Base64 Encoder and Decoder — Encode & Decode Text Online
Encode text to Base64 or decode Base64 strings back to text instantly. Supports full UTF-8 for international characters and emoji. Free, private, runs entirely in your browser.
URL Encoder and Decoder — Percent Encoding Tool Online
Encode text to URL-safe percent-encoding or decode percent-encoded strings instantly. Supports encodeURI, encodeURIComponent, and RFC 3986. Free, private, browser-based.
Hash Generator — Create MD5 SHA-1 SHA-256 SHA-512 Online
Generate MD5, SHA-1, SHA-256, SHA-512 hashes from text or files instantly. All processing in your browser via Web Crypto API — try it free, no signup.
JSON Formatter — Beautify, Minify & Validate JSON Online
Format, beautify, and minify JSON data with real-time validation. Configurable indentation (2/4/tab), instant error detection, copy and download. Free online JSON formatter for developers.
More Developer Tools
JSON Formatter — Beautify, Minify & Validate JSON Online
Format, beautify, and minify JSON data with real-time validation. Configurable indentation (2/4/tab), instant error detection, copy and download. Free online JSON formatter for developers.
JWT Decoder — Inspect JSON Web Tokens Online
Decode and inspect JSON Web Tokens instantly. View color-coded header, payload, and signature. Check token expiration, claims, and algorithm — all in your browser. Free, private, no data sent to any server.
Base64 Encoder and Decoder — Encode & Decode Text Online
Encode text to Base64 or decode Base64 strings back to text instantly. Supports full UTF-8 for international characters and emoji. Free, private, runs entirely in your browser.
URL Encoder and Decoder — Percent Encoding Tool Online
Encode text to URL-safe percent-encoding or decode percent-encoded strings instantly. Supports encodeURI, encodeURIComponent, and RFC 3986. Free, private, browser-based.
HTML Entity Encoder and Decoder — Escape HTML Characters Online
Encode special characters to HTML entities or decode entities back to text. Prevent XSS attacks and display code safely. Free, instant, browser-based.
Morse Code Translator — Encode & Decode Text to Morse Online
Convert text to Morse code or decode Morse back to text instantly. Hear audio playback with Web Audio API. Supports A-Z, 0-9, and punctuation. Free online translator.
ROT13 Encoder and Decoder — Caesar Cipher Tool Online
Encode or decode text with ROT13 and ROT-N Caesar ciphers instantly. Adjustable rotation 1-25, visual cipher wheel, self-inverse. Free, private, browser-based.
AES Encrypter and Decrypter — Secure AES-256-GCM Encryption
Encrypt and decrypt text with AES-256-GCM using a password you choose. All processing happens in your browser via the Web Crypto API — your data never leaves your device. Try it free.
About Developer Tools
Developer tools automate the repetitive parts of software work: formatting JSON, encoding/decoding Base64, decoding JWTs to verify token claims, generating UUIDs, formatting XML, diffing configurations. These aren't glamorous tasks, but they're the friction points that eat 10-15 minutes multiple times a day — adding up to hours weekly. Running them in a clean browser tab beats wrestling with CLI dependencies or IDE extensions that might ship your private data to a third party.
Why it matters
Fast, client-side developer tools fundamentally matter because they're used with sensitive data. JWT tokens contain user identity. Base64 payloads might encode API keys. JSON dumps include customer records. If a 'developer tool' sends your input to a server to process, you've just leaked production secrets. ZestLab's dev tools run 100% client-side with no network calls after page load — what you paste stays in your browser.
Privacy and safety
All developer tools here execute in-browser using pure JavaScript. There's no 'decode server' or 'format API' — your JWT, your JSON, your encoded payload is parsed by code running on your laptop. Verify this yourself with browser DevTools → Network tab: you'll see zero outbound requests when using any tool. That's a standard we hold because dev tools handle secrets.
Best practices
- Never paste production JWT or API tokens into ANY online tool without verifying it runs client-side (check the Network tab)
- Use browser private/incognito mode for one-off decoding of sensitive payloads
- Bookmark tools you use daily — ZestLab tool URLs are stable and don't require accounts
- When formatting JSON with secrets for team review, redact credentials before sharing the formatted output