Binary Protocol Designer

Binary Protocol Designer

Local packet calculation only · no device connection or network transfer.

1. Define a bit layout

Big-endian writes high bits first. Little-endian is available only for aligned whole-byte fields. Alignment gaps and final spare bits are zero.

Load or apply a layout to begin.

Comments & questions

Binary Protocol Designer

Design a small binary packet from explicit fields. The tool places bits in order, inserts zero bits when you request byte alignment, and shows the exact hex bytes and field offsets. Paste a same-length hex packet to decode values through the same layout. It runs in your browser and does not connect to a device.

Key features

  • Pack 1–32-bit unsigned or two's-complement signed integers, including fields that cross byte boundaries
  • Set per-field big-endian or little-endian byte order; little-endian requires byte alignment and a whole-byte width
  • Request zero-filled byte alignment before any field and inspect bit and byte offsets
  • Decode a packet using the current layout, checking exact length and all padding bits
  • Download the editable layout JSON, packet hex text and a decoded field report

How to use

  1. Load the example layout or paste a local-binary-layout-v1 JSON definition and apply it.
  2. Review field widths, signedness, byte order and optional byte alignment; edit decimal values in the table.
  3. Encode the layout to produce packet hex and bit/byte offsets.
  4. Paste or change same-length packet hex and decode it through the layout.
  5. Download the layout, packet bytes as hex text or the field report.

Use cases

  • Check a packed version/flags header followed by a little-endian length field
  • Verify signed telemetry deltas crossing a byte boundary
  • Explain exactly where each field starts when reviewing a device protocol draft

Frequently asked questions

What is the bit order for packed fields?

Big-endian fields are written most-significant bit first into the packet, with bit 0 at the high bit of byte 0. This also applies when a field crosses a byte boundary.

When can I select little-endian?

Only for fields whose start offset and width are both multiples of 8. Their bytes are stored least-significant first. Use alignBefore=byte when a preceding bit field leaves an unaligned offset.

How are negative values represented?

Signed fields use two's complement at the selected width. For example, a signed 12-bit -17 is encoded as 0xFEF across its 12-bit range; values outside the exact signed range are rejected.

Are padding bits ignored during decoding?

No. Requested alignment gaps and unused bits at the end of the last byte must be zero. Nonzero padding yields an error with the bit position.

What packet sizes are supported?

This version accepts 1–64 fields, each 1–32 bits, with at most 2,048 used bits (256 bytes). The JSON layout is limited to 64 KiB. It does not implement checksums, floating-point formats or a live serial connection.

Does decoding use the decimal values in the layout?

The layout supplies field widths, order and alignment. Decoded values replace the displayed decimal inputs after a successful decode; the input hex must have the exact packet length.

Privacy

Packet layouts and hex values are processed in your browser. This tool does not contact a device or upload your packet.

Related Tools

Base64 EncoderNumber Base ConverterHash GeneratorWasm Module InspectorHreflang Matrix CheckerAST Query PlaygroundContainer Build GraphDependency Graph ExplorerSemver Range LabCron Schedule AuditorPatch Review WorkbenchSource Map ExplorerLocalization Catalog AuditorStructured Data ReviewerHTTP Archive AnalyzerWebhook Signature LabProtobuf Schema WorkbenchGraphQL Schema LabAvro Schema EvolutionLocal SQL WorkbenchSchema Form BuilderMesh Repair WorkbenchPipe Network LabRobot Arm Kinematics LabThermal Network LabBeam Response LabGear Train DesignerTolerance Stackup LabSensor Calibration FitPCB Stackup PlannerDigital Filter DesignerNetwork Reachability MapSun Shadow MapGPS Error SimulatorDigital Logic SimulatorAnalog Circuit LabMechanism Linkage LabAnalysis Mesh GeneratorOpenAPI Contract InspectorDatabase Migration PlannerDimensional Equation CheckerTruss Force LabBoolean Minimization LabControl Response LabQueueing Simulation LabGeofence Event SimulatorCoordinate Reference LabSurvey Traverse LabRaster Classification LabChoropleth Design LabMap Print ComposerRaster Reprojection LabElevation Contour MakerTerrain Viewshed LabWatershed DelineatorMap Tile PackagerText File Encoding WorkbenchFilesystem Portability AuditorSBOM License ExplorerFile Signature Auditornpm Lockfile Conflict ResolverSource Secret AuditorOffline Web Package BuilderCertificate Chain InspectorTorrent Metainfo InspectorChunked File PackagerEncrypted File VaultDuplicate File FinderArchive WorkbenchDesign Token ManagerSpacing Token DesignerResponsive Type SystemPackaging Dieline DesignerSVG Icon Sprite PackerFlex Layout PlaygroundCSS Grid PlaygroundRegex Equivalence LabMarkdown Repository AuditorLog Template MinerResponsive Layout AuditorEmail Template PreviewInternal Link GraphState Machine TesterPetri Net SimulatorGit History VisualizerCurl Request WorkbenchHex File EditorBinary Patch WorkbenchFile Signature WorkbenchAPI Mock SandboxSchema Column MapperEvent Log SessionizerER Diagram DesignerTime Series Gap AuditorStratified Data SplitterData Lineage DesignerDecision Tree LabData Anonymization WorkbenchData Expectation RunnerJSON Schema ValidatorBasket Pattern AnalyzerRobots Policy TesterSEO HTML AuditorAccessibility Structure AuditorSyndication Feed WorkbenchIndexNow Payload BuilderCrawl Log AnalyzerCSP Policy WorkbenchSearch Performance AnalyzerCSV Formula Risk AuditorCORS Response SimulatorCache Header LabCookie Policy InspectorWeb Vitals Trace LabSitemap Health AuditorBatch File RenamerFile Manifest VerifierFolder Space MapFolder Difference ReviewerRoute Order OptimizerGeoJSON Map EditorPolygon Overlay LabCartographic Label PlacerSpatial Table JoinGeoJSON Topology AuditorGPX Track AnalyzerTrack Privacy RedactorCSV Table JoinCSV Pivot WorkbenchScientific Data ProfilerTabular Cleaning WorkbenchRecord ReconciliationData Dictionary BuilderCanonical Graph AuditorRedirect Plan TesterHTTP response and ping reference testBrowser and System InformationJSON ↔ YAML ConverterXML ↔ JSON ConverterHTML FormatterJavaScript MinifierMock Data Generator.gitignore GeneratorLicense GeneratorUser-Agent ParserPassword Strength CheckerCode to ImageXML FormatterHTTP Status Code LookupMIME Type LookupJS & SQL String EscapeCSS Box Shadow GeneratorCSS Gradient GeneratorIndent ConverterUnicode Escape ConverterUnicode InspectorJSON Structure DiffMarkdown Table GeneratorJSON FormatterURL EncoderSQL FormatterCron Expression GeneratorRegex TesterUUID GeneratorTimestamp ConverterJWT DecoderHTML Entity ConverterMarkdown PreviewCSS MinifierMeta Tag GeneratorJSON ↔ CSVCase ConverterImage to Base64
Explore all Dev Tools tools →Image/Media →Text/Convert →Life/Fun →