Home › Developer Tools › Endianness Converter

Endianness Converter

Enter a hex value, a list of bytes or a decimal number and see it with its bytes reversed, read as big-endian and little-endian integers and floats, plus every 16-bit word-swap order used by Modbus devices.

Last updated:

Enter your values to see the result.
Advertisement
Advertisement

How to use the Endianness Converter

  1. Choose the input type: hex, unsigned decimal or signed decimal.
  2. Pick a width or leave it on Auto.
  3. Type the value. For raw bytes from a dump or packet, separate them with spaces.
  4. Click Convert (results also update as you type).
  5. Read the swapped value and look up the right order in the byte-order table.

Byte orders at a glance (0x12345678)

OrderNameBytes in memoryWhere you see it
ABCDBig-endian12 34 56 78Network protocols, Java class files, many file formats, Motorola 68k, Modbus default
DCBALittle-endian78 56 34 12x86/x64 PCs, most ARM devices, Windows and Linux memory dumps
CDABWord-swapped56 78 12 34Some PLCs and Modbus devices for 32-bit values
BADCByte-swapped words34 12 78 56Some Modbus devices and old mid-endian systems

Byte swap in code

Language32-bit swap
C / C++ (GCC, Clang)__builtin_bswap32(x), or htonl/ntohl for host ↔ network order
C++23std::byteswap(x)
Pythonint.from_bytes(x.to_bytes(4, 'big'), 'little'), or struct.unpack('<I', data)
JavaScriptnew DataView(buf).getUint32(0, true) reads little-endian
JavaInteger.reverseBytes(x), ByteBuffer.order(ByteOrder.LITTLE_ENDIAN)
C#BinaryPrimitives.ReverseEndianness(x)

Tips

  • Swap bytes, not hex digits: reversing "12345678" character by character gives 87654321, which is wrong.
  • If a sensor reading looks absurd (huge or tiny), the byte order is the usual suspect. Compare the float column for each order with the value you expect.
  • For float bit layouts (sign, exponent, mantissa) use the IEEE 754 Converter.

Frequently asked questions

What is endianness?

Endianness is the order in which the bytes of a multi-byte number are stored. Big-endian stores the most significant byte first (at the lowest address); little-endian stores the least significant byte first. 0x12345678 is stored as 12 34 56 78 in big-endian and 78 56 34 12 in little-endian.

Which systems are little-endian?

x86 and x86-64 processors, and ARM and RISC-V as they are normally configured, are little-endian. Network protocols such as TCP/IP use big-endian, which is why it is called network byte order.

How do I convert big-endian to little-endian?

Reverse the order of the bytes, not the individual hex digits. 0x12345678 becomes 0x78563412. The same operation converts in both directions.

What are CDAB and BADC byte orders?

They are mixed orders seen when 32-bit values are split across two 16-bit registers, as in Modbus. CDAB swaps the two 16-bit words (0x12345678 → 0x56781234) and BADC swaps the bytes inside each word (→ 0x34127856). If a float from a device looks wrong, try each order.

Does endianness affect single bytes or text?

No. A single byte has no byte order, and UTF-8 text is a sequence of single bytes. Endianness matters for multi-byte numbers and for UTF-16/UTF-32 text, which is what a byte order mark (BOM) indicates.

How does a negative number look when swapped?

Negative integers are stored in two's complement. −2 as a 32-bit value is 0xFFFFFFFE; with the bytes swapped it reads 0xFEFFFFFF, which is −16,777,217 as a signed integer.

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

Hex to DecimalConvert hex to decimal instantly with steps and signed mode.IEEE 754 Floating Point ConverterConvert decimals to 32/64-bit IEEE 754 floats: toggle bits, see hex, exact value and rounding error.Two's Complement CalculatorDecimal to two's complement binary and back for 4-64 bits, with invert-and-add-1 steps.Checksum CalculatorCompute 8-bit sum, two's complement LRC, XOR/BCC, NMEA, Fletcher and Internet checksums of bytes.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.Binary to DecimalConvert binary to decimal instantly with steps and signed mode.Decimal to BinaryConvert decimal to binary 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.JSON to Go StructTurn JSON into Go structs with inferred types, nested structs and json tags.JSON to Python ClassGenerate Python dataclasses, Pydantic models or TypedDicts with type hints from JSON.JSON SorterSort JSON keys A-Z recursively, sort arrays by value or by a key, then pretty-print or minify.JSON to HTML TableConvert a JSON array of objects into clean HTML table code with CSS styles and a live preview.CSV to SQL ConverterConvert CSV to SQL CREATE TABLE and INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server.IPv4 to IPv6 ConverterConvert IPv4 to IPv4-mapped, 6to4 and NAT64 IPv6, extract IPv4 from IPv6, and get int/hex/binary.cURL to Code ConverterConvert curl commands to JavaScript fetch, Axios, Python requests, Node.js, PHP and Go code.Code to ImageTurn code into a beautiful syntax-highlighted PNG with themes, window frame and background.Excel to JSON ConverterConvert Excel sheets (XLSX, XLS, ODS) to JSON with header row, type and shape options.CSV to Excel ConverterConvert CSV files to a real .xlsx workbook with typed numbers and dates, one sheet per file.CSV SplitterSplit a large CSV into smaller files by row count, file count or column value, header kept.CSV MergerCombine many CSV files into one, matching columns by name, with dedupe and a source column.VCF to CSV ConverterConvert vCard (.vcf) contacts to CSV for Google or Outlook, or turn a CSV back into a VCF.Calendar Event (.ics) GeneratorCreate an .ics calendar invite with time zone, reminders and repeats + Google/Outlook links.CSV Column ExtractorPick, reorder and rename CSV columns, filter rows by value, and export a new CSV or JSON.CSV Diff CheckerCompare two CSV files by key column and see added, removed and changed rows cell by cell.CSV Duplicate Row RemoverRemove duplicate rows from a CSV by all or selected columns and download the cleaned file.CSV to HTML TableTurn CSV into clean HTML table code with a live preview, styling options and one-click copy.CSV to Markdown TableConvert CSV to a neatly aligned GitHub Markdown table with column alignment and live preview.CSV TransposeSwap rows and columns of CSV, TSV or pasted spreadsheet data, with delimiter auto-detect.Date Format ConverterConvert any date to ISO 8601, RFC 2822, Unix time and custom strftime, moment or Java patterns.ENV to JSON ConverterConvert .env files to JSON or YAML and JSON back to .env, with quotes and multiline values.File to Base64Convert any file to a Base64 string or data URI with MIME detection, line wrap and download.HTML Table to CSVExtract any table from HTML or page source to CSV, TSV or JSON, with colspan and rowspan handled.INI to JSON ConverterConvert INI and CFG files to JSON and JSON back to INI, with sections, arrays and types.IP Address ConverterConvert IPv4 to decimal, hex, binary, octal and back, with class and private/public check.ISBN Converter & ValidatorConvert ISBN-10 to ISBN-13 and back, validate check digits and hyphenate, one or in bulk.JSON Flatten / UnflattenFlatten nested JSON to dot or bracket path keys, or unflatten flat keys back to nested JSON.JSON to Dart ClassTurn JSON into Dart model classes with fromJson, toJson, null safety and nested classes.JSON to Java ClassTurn JSON into Java POJOs or records with Lombok, getters/setters and Jackson or Gson annotations.JSON to Kotlin Data ClassTurn JSON into Kotlin data classes for kotlinx.serialization, Gson, Moshi or Jackson.JSON to Markdown TableTurn a JSON array of objects into a GitHub Markdown table with column picker and alignment.
See all 129 Data & File Format Converters →