Number base converter and bitwise calculator
Enter a binary, octal, decimal or hexadecimal number (or another base up to 36) and see every base at once, with the signed and unsigned values at 8, 16, 32 and 64 bits, and calculate AND, OR, XOR, NOT and shifts. Numbers of any size stay exact. It runs in your browser.
This tool needs JavaScript. If you still see this after a few seconds, JavaScript is switched off in your browser or the page did not load completely: turn JavaScript on or reload the page.
How to use it
- Type a number in the box. Put
0xin front for hex,0bfor binary,0ofor octal, or choose the base yourself. Every base appears at once. - Look at "64-bit signed" to see what negative number it is in two's complement.
- Below, enter A and B, choose the operation and the bit width, and get the result in hex, binary and decimal.
Frequently asked questions
Why can this tool handle big numbers exactly?
The ordinary numbers of JavaScript hold whole numbers exactly only up to 2^53 (about 9 quadrillion); beyond that the last digits go wrong. This tool uses BigInt, so every digit is exact. It works with 64-bit numbers and larger, such as 0xFFFFFFFFFFFFFFFF.
What is two's complement, and what are signed numbers?
Computers store a negative number by flipping the bits and adding one. At 8 bits, -1 is 11111111 (255 if read as unsigned). The leftmost bit says the number is negative. The 8, 16, 32 and 64-bit rows show both readings.
What is the difference between a signed and an unsigned right shift?
>> shifts in copies of the sign bit on the left, so a negative number stays negative. >>> shifts in zeros, so the result is always positive. The difference shows with negative numbers.
Good to know
- You may separate digits with underscores, spaces or commas, like
1111_0000or1,000,000. - In the bitwise part, a number wider than the chosen width uses only its low bits (as a variable of that type in C would).
- Fractions, like 1.5, are not supported in another base.
Your data stays on your device
Everything runs in your browser. What you type, paste or open is not sent to freesabai's servers or anyone else's, and is not kept in the browser: close the page and it is gone. The site only counts how many times this page was opened and how many times someone copied or saved a result (never what was pasted or the result, and you can switch the counting off in the footer; see the privacy policy).
Report a problem or suggest an idea
Found a bug, or want this tool to do more? Tell us on the feedback page. No sign-up.
Other developer tools
JSON and data
- JSON formatter and validatorFormat, minify and validate JSON, find the error, fold it into levels
- JSON to YAML converterTurn JSON into YAML, key order kept, nothing leaves your device
- YAML to JSON converterTurn YAML into JSON, and find the line where the YAML is wrong
- JSON to CSV converterTurn a JSON list into CSV for Excel, Thai text included
- CSV to JSON converterTurn CSV into JSON, any separator, quoted fields handled
- CSV viewerOpen a CSV file as a table, sort a column, search, no spreadsheet needed
- Text and JSON diff checkerSee what changed between two texts, side by side or unified, with word highlights
Encoding, hashes and tokens
- Base64 encode and decodeBase64 for text (Thai and UTF-8), URL-safe, and files to and from Base64
- Hash generator: MD5, SHA-256, HMACHash text or files with MD5, SHA-1, SHA-256, SHA-512 and HMAC, and verify a checksum
- JWT decoderRead the header and payload of a JWT, with times you can read (decode only, no signature check)
- URL encode and decodePercent-encode or decode a link, Thai in URLs included, and take a URL apart
- HTML entities encode and decodeTurn special characters into & < > " and back
Generators
Time, numbers and colour
- Unix timestamp converterConvert a timestamp (seconds or milliseconds) to a date and back, with time zones
- Cron expression explainerRead a cron expression in plain words and see its next 5 runs
- Number base converterConvert between binary, octal, decimal and hex, and do bitwise AND, OR, XOR and shifts
- Colour converter: HEX, RGB, HSLConvert a colour between HEX, RGB and HSL, or pick one by eye
- Colour contrast checker (WCAG)Check the contrast between text and background colours for WCAG AA and AAA
Text and code
- Regex testerTry a regular expression, see matches and groups, protected from regexes that never finish
- Markdown previewType Markdown and see it rendered at once, safely, with embedded scripts never run
- Character, word and line counterCount characters, words (Thai too), lines, sentences, paragraphs and reading time