Home › Developer Tools › Decimal to Binary Converter

Decimal to Binary Converter

Type a decimal number to see it in binary instantly, with the divide-by-2 working shown step by step. Pick a bit width to get signed two's complement binary for negative numbers.

Last updated:

Examples

Step-by-step conversion

    Advertisement
    Advertisement

    How to use the Decimal to Binary Converter

    1. Type a decimal number in the left box. The binary result appears instantly.
    2. Need the other direction? Type in the right box, or press ⇄ to swap.
    3. Working with negative numbers? Choose a signed two's complement bit width.
    4. Read the steps below the result to see exactly how the conversion works.
    5. Copy the result with one click.

    How to convert decimal to binary

    Use repeated division by 2:

    1. Divide the number by 2.
    2. Write down the remainder (0 or 1).
    3. Divide the quotient by 2 again, and repeat until the quotient is 0.
    4. Read the remainders from the last to the first.

    Example: 13 ÷ 2 = 6 r 1; 6 ÷ 2 = 3 r 0; 3 ÷ 2 = 1 r 1; 1 ÷ 2 = 0 r 1 → 1101.

    Negative numbers and two's complement

    Computers store signed integers in two's complement: a negative number −x is stored as 2n − x in n bits. That makes −1 all ones (FF in 8 bits, FFFFFFFF in 32 bits) and gives each width a range of −2n−1 to 2n−1 − 1.

    WidthSigned range−1 in hex
    8-bit−128 to 127FF
    16-bit−32,768 to 32,767FFFF
    32-bit−2,147,483,648 to 2,147,483,647FFFFFFFF
    64-bit−9,223,372,036,854,775,808 to 9,223,372,036,854,775,807FFFFFFFFFFFFFFFF

    Decimal, hex and binary table (0–255)

    All values that fit in one byte. Use Ctrl+F to find a value quickly.

    DecimalHexBinary (8-bit)
    0000000000
    1100000001
    2200000010
    3300000011
    4400000100
    5500000101
    6600000110
    7700000111
    8800001000
    9900001001
    10A00001010
    11B00001011
    12C00001100
    13D00001101
    14E00001110
    15F00001111
    161000010000
    171100010001
    181200010010
    191300010011
    201400010100
    211500010101
    221600010110
    231700010111
    241800011000
    251900011001
    261A00011010
    271B00011011
    281C00011100
    291D00011101
    301E00011110
    311F00011111
    322000100000
    332100100001
    342200100010
    352300100011
    362400100100
    372500100101
    382600100110
    392700100111
    402800101000
    412900101001
    422A00101010
    432B00101011
    442C00101100
    452D00101101
    462E00101110
    472F00101111
    483000110000
    493100110001
    503200110010
    513300110011
    523400110100
    533500110101
    543600110110
    553700110111
    563800111000
    573900111001
    583A00111010
    593B00111011
    603C00111100
    613D00111101
    623E00111110
    633F00111111
    644001000000
    654101000001
    664201000010
    674301000011
    684401000100
    694501000101
    704601000110
    714701000111
    724801001000
    734901001001
    744A01001010
    754B01001011
    764C01001100
    774D01001101
    784E01001110
    794F01001111
    805001010000
    815101010001
    825201010010
    835301010011
    845401010100
    855501010101
    865601010110
    875701010111
    885801011000
    895901011001
    905A01011010
    915B01011011
    925C01011100
    935D01011101
    945E01011110
    955F01011111
    966001100000
    976101100001
    986201100010
    996301100011
    1006401100100
    1016501100101
    1026601100110
    1036701100111
    1046801101000
    1056901101001
    1066A01101010
    1076B01101011
    1086C01101100
    1096D01101101
    1106E01101110
    1116F01101111
    1127001110000
    1137101110001
    1147201110010
    1157301110011
    1167401110100
    1177501110101
    1187601110110
    1197701110111
    1207801111000
    1217901111001
    1227A01111010
    1237B01111011
    1247C01111100
    1257D01111101
    1267E01111110
    1277F01111111
    1288010000000
    1298110000001
    1308210000010
    1318310000011
    1328410000100
    1338510000101
    1348610000110
    1358710000111
    1368810001000
    1378910001001
    1388A10001010
    1398B10001011
    1408C10001100
    1418D10001101
    1428E10001110
    1438F10001111
    1449010010000
    1459110010001
    1469210010010
    1479310010011
    1489410010100
    1499510010101
    1509610010110
    1519710010111
    1529810011000
    1539910011001
    1549A10011010
    1559B10011011
    1569C10011100
    1579D10011101
    1589E10011110
    1599F10011111
    160A010100000
    161A110100001
    162A210100010
    163A310100011
    164A410100100
    165A510100101
    166A610100110
    167A710100111
    168A810101000
    169A910101001
    170AA10101010
    171AB10101011
    172AC10101100
    173AD10101101
    174AE10101110
    175AF10101111
    176B010110000
    177B110110001
    178B210110010
    179B310110011
    180B410110100
    181B510110101
    182B610110110
    183B710110111
    184B810111000
    185B910111001
    186BA10111010
    187BB10111011
    188BC10111100
    189BD10111101
    190BE10111110
    191BF10111111
    192C011000000
    193C111000001
    194C211000010
    195C311000011
    196C411000100
    197C511000101
    198C611000110
    199C711000111
    200C811001000
    201C911001001
    202CA11001010
    203CB11001011
    204CC11001100
    205CD11001101
    206CE11001110
    207CF11001111
    208D011010000
    209D111010001
    210D211010010
    211D311010011
    212D411010100
    213D511010101
    214D611010110
    215D711010111
    216D811011000
    217D911011001
    218DA11011010
    219DB11011011
    220DC11011100
    221DD11011101
    222DE11011110
    223DF11011111
    224E011100000
    225E111100001
    226E211100010
    227E311100011
    228E411100100
    229E511100101
    230E611100110
    231E711100111
    232E811101000
    233E911101001
    234EA11101010
    235EB11101011
    236EC11101100
    237ED11101101
    238EE11101110
    239EF11101111
    240F011110000
    241F111110001
    242F211110010
    243F311110011
    244F411110100
    245F511110101
    246F611110110
    247F711110111
    248F811111000
    249F911111001
    250FA11111010
    251FB11111011
    252FC11111100
    253FD11111101
    254FE11111110
    255FF11111111

    Frequently asked questions

    How do you convert decimal to binary?

    Divide the number by 2, write down the remainder (0 or 1), and repeat with the quotient until it is 0. Read the remainders from bottom to top. 42 → 21 r0, 10 r1, 5 r0, 2 r1, 1 r0, 0 r1, so 42 = 101010.

    What is 255 in binary?

    255 is 11111111: eight 1 bits, the largest number that fits in one byte.

    How do I write −1 in binary?

    In two's complement, −1 is all ones: 11111111 in 8 bits, 1111111111111111 in 16 bits. Choose the signed mode and bit width to see it.

    How do I convert a decimal fraction to binary?

    Multiply the fraction by 2 repeatedly; each time the whole part (0 or 1) is the next bit. 0.625 → 1.25 (1), 0.5 (0), 1.0 (1), so 0.625 = 0.101. Some fractions like 0.1 repeat forever and are cut off with "…".

    How many bits does a number need?

    The tool shows it under "Bits needed". In general n needs ⌊log₂ n⌋ + 1 bits, so 255 needs 8 bits and 256 needs 9.

    Is there a size limit?

    No. Numbers of any length are converted exactly with BigInt.

    Are all the tools on FreeToolCabin tested for quality and accuracy?

    Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

    Related tools

    Binary to DecimalConvert binary to decimal instantly with steps and signed mode.Number Base ConverterConvert numbers between any bases from 2 to 36, with fractions and steps.Hex to DecimalConvert hex to decimal instantly with steps and signed mode.Binary TranslatorConvert text to binary, hex, octal and back.Binary Search Tree VisualizerInsert, delete and find in BST, AVL and red-black trees with animated rotations and traversals.Guess the Number GameGuess the secret number with higher/lower or warm/cold hints, or let the computer guess yours.IP Address ConverterConvert IPv4 to decimal, hex, binary, octal and back, with class and private/public check.Logic Gate SimulatorBuild logic circuits with AND, OR, NOT, XOR gates and flip-flops; see live outputs and truth tables.JSON to Excel ConverterTurn JSON into a styled .xlsx spreadsheet; nested arrays become their own linked sheets.JSON to CSVConvert JSON data to CSV for spreadsheets.CSV to JSONConvert CSV data to JSON with live preview.Excel to CSVConvert XLSX spreadsheets to CSV.CSV ViewerOpen a CSV or TSV file as a sortable, filterable table.Excel Viewer (XLSX / XLS)Open XLSX, XLS and ODS spreadsheets in your browser without Excel.Line Ending ConverterConvert text and files between CRLF, LF and CR line endings.Markdown to HTMLConvert Markdown to clean HTML with a live editor.XML to JSONConvert XML to JSON with validation.Text Encoding ConverterDetect and convert text file encodings like UTF-8, UTF-16 and Latin-1.JSON ViewerExplore JSON as a collapsible tree, search keys and values and copy any node's path.TTF to WOFF2 ConverterConvert TTF and OTF fonts to WOFF2 or WOFF and get a ready @font-face CSS snippet.Chmod CalculatorConvert Linux file permissions between checkboxes, octal (755) and symbolic (rwxr-xr-x) notation.JSON to TypeScriptGenerate TypeScript interfaces or types from JSON, with nested types and optional fields.Morse Code TranslatorTranslate text to Morse code and back, then play it as sound or a blinking light, or save a WAV.HTML Table GeneratorBuild HTML tables in an editable grid with styles, header rows, CSV import and live preview.Hex to Text ConverterConvert hex to text and text to hex with UTF-8 support and space, 0x, \x or comma formats.JSON to XML ConverterConvert JSON to well-formed XML with attributes, arrays and pretty print.JSON to YAML ConverterConvert JSON to clean YAML as you type, with indent, quoting and sort options.YAML to JSON ConverterConvert YAML to pretty or minified JSON, with errors pinned to the exact line.HTML to Markdown ConverterTurn HTML or pasted rich text into clean Markdown with tables and live preview.Markdown Table GeneratorBuild Markdown tables in a grid or paste from Excel/CSV, with alignment and preview.JSON ValidatorCheck JSON with the exact line and column of each error, fix tips and one-click auto-fix.Image to Base64Convert images to Base64 data URIs, CSS backgrounds and HTML img tags in your browser.Base64 to ImagePaste a Base64 string or data URI to preview, identify and download the image.JSON CompareCompare two JSON documents and see every added, removed and changed path.Decimal to HexConvert decimal to hex instantly with steps and signed mode.XML to CSV ConverterConvert XML to CSV: detects repeating records, flattens nested data, pick your columns.CSV to XML ConverterConvert CSV to well-formed XML with custom root and row names, escaping and pretty print.TOML to JSON ConverterConvert TOML to JSON and JSON to TOML with a full v1.0 parser and clear error lines.Boolean Algebra SimplifierSimplify boolean expressions or minterm lists to minimal SOP and POS with Quine-McCluskey steps.Compare Excel FilesCompare two Excel spreadsheets cell by cell, highlight changes and export a diff report.CSV CleanerClean messy CSV in one click: trim spaces, drop empty rows and columns, fix headers, dedupe.CSV VLOOKUP ToolJoin two CSV or Excel files on a key column like VLOOKUP, with left, inner and full joins.Remove Duplicates in ExcelFind and remove or highlight duplicate rows in XLSX or CSV files by the columns you choose.GeoJSON ViewerView GeoJSON on a map, inspect and edit properties, validate against RFC 7946 and export.GPX ViewerOpen GPX tracks on a map with distance, elevation profile, moving time, speed and splits.JSON Repair ToolFix broken JSON automatically: trailing commas, quotes, comments, truncated data, with a diff.Karnaugh Map SolverSolve 2–6 variable K-maps: click cells or enter minterms to get the minimal SOP or POS with groups.Merge Excel FilesCombine XLSX, XLS and CSV files into one workbook or append all rows into a single sheet.Parquet File ViewerOpen Apache Parquet files in your browser: schema, rows, filters and CSV or JSON export.Query CSV with SQLRun SQL on CSV, Excel, JSON and Parquet files in your browser with DuckDB. Join and export.Online Serial MonitorTalk to Arduino, ESP32 and USB serial devices in your browser: log, send, plot and save.Split Excel FileSplit an Excel sheet into several files by row count or by each value in a column, as ZIP.SQL Create Table GeneratorDefine columns, keys, defaults and indexes; get CREATE TABLE SQL for MySQL, Postgres and more.SQL IN Clause GeneratorTurn a pasted list into a SQL IN ('a','b') clause with quoting, dedupe and 1,000-item chunks.SQL Online CompilerRun SQL queries online on SQLite with sample databases, a result grid, CSV export and .db save.SQL to ER DiagramPaste CREATE TABLE statements and get an entity-relationship diagram with keys and links.XML to XSD GeneratorGenerate an XML Schema (XSD) from sample XML: types, occurrences, attributes and namespaces.XML ValidatorCheck if XML is well-formed, see the exact line and column of each error and pretty-print it.CSV to VCF ConverterConvert a contacts CSV into a vCard (.vcf) file, mapping columns to name, phone, email and more.CSV to YAML ConverterConvert CSV rows to a YAML list of mappings with type inference and delimiter detection.Endianness ConverterSwap byte order of 16, 32 and 64-bit hex values and see big- and little-endian integers and floats.Excel to SQL ConverterTurn an Excel sheet into CREATE TABLE and INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server.Excel to VCF ConverterTurn an Excel contact list into a vCard .vcf file for iPhone, Android, Google or Outlook.File to C ArrayConvert any file into a C or C++ byte array header, like xxd -i, with const and PROGMEM options.Image to C ArrayConvert images to monochrome, RGB565 or RGB888 C arrays for OLED, LCD and TFT displays.JSON Merge ToolDeep-merge two or more JSON objects with array concat, replace or union and a conflict rule.JSONL to CSV ConverterConvert JSON Lines / NDJSON to CSV with flattened columns; streams large files locally.PHP Unserialize OnlineDecode PHP serialize() strings to JSON, a tree or print_r, and serialize JSON back to PHP.
    See all 129 Data & File Format Converters →