Developer Utilities · Free tool
WebSocket Frame Parser
Decode raw WebSocket frame bytes — FIN, opcode, mask, payload length, masking key, and unmasked payload.
Advertisement
What it does
Paste raw WebSocket frame hex bytes (captured from Wireshark, Chrome DevTools Network tab, or your server logs) and decode the frame structure: FIN flag, RSV bits, opcode (text / binary / close / ping / pong / continuation), MASK flag, payload length (with extended-length encoding for >125 bytes), masking key (if present), and the actual payload — both as hex bytes and decoded UTF-8 if the opcode indicates text.
The WebSocket protocol (RFC 6455, December 2011) defines a binary framing format on top of HTTP for full-duplex client-server communication. After the initial HTTP upgrade handshake, all messages flow as frames following a strict byte layout: byte 0: FIN bit (1=last frame of message), 3 RSV bits, 4-bit opcode; byte 1: MASK bit (1=client-to-server, must be set), 7-bit length encoding; bytes 2-9 (variable): extended length if length 126 or 127; bytes (var)-(var): 4-byte masking key if MASK bit set; remaining bytes: payload (XOR-masked if from client). Server-to-client frames don’t mask; client-to-server frames must.
Common reasons to parse a frame: debugging WebSocket bugs in production logs (why is this connection closing? what was the last frame sent?); verifying mask correctness (one of the most common WebSocket bugs is forgetting to mask client-to-server payloads, which causes server to drop the connection); protocol learning for engineers new to WebSockets; Wireshark export analysis when troubleshooting middleware proxy issues that strip or modify frames.
Embed this tool on your siteShow snippetHide
Paste this snippet into any page. Loads on-demand (lazy), no tracking scripts, and sized to most dashboards. Replace the height to fit your layout.
<iframe src="https://freetoolarena.com/embed/websocket-frame-parser" width="100%" height="720" frameborder="0" loading="lazy" title="WebSocket Frame Parser" style="border:1px solid #e2e8f0;border-radius:12px;max-width:720px;"></iframe>How to use it
- Paste hex bytes (with or without spaces, with or without 0x prefix). The parser tolerates common formats: `81 05 48 65 6c 6c 6f`, `0x81 0x05 ...`, `8105 48656c6c6f`.
- Read parsed fields: FIN, opcode (with name like 'text frame'), MASK, payload length, masking key (if any), payload bytes.
- If opcode is text (0x1), the decoded UTF-8 string appears below the hex payload.
- Verify mask correctness: client-to-server frames MUST have MASK=1; server-to-client frames MUST have MASK=0. The parser flags violations.
- For multi-frame messages (a single message split across multiple frames), parse each frame separately. The FIN bit indicates the last frame of a message; FIN=0 means continuation expected.
When to use this tool
- Debugging WebSocket protocol-level issues that aren't visible at the message API level.
- Validating frames captured by Wireshark, mitmproxy, or WSdump.
- Teaching / learning the WebSocket framing format.
- Reviewing your own WebSocket implementation for spec compliance.
When not to use it
- Application-level debugging — most WebSocket bugs are above the framing layer (auth, message format, timing, reconnection logic). For those use Chrome DevTools' WebSocket inspector or your library's debug logs.
- Compressed frames (permessage-deflate extension) — those are not handled here. Wireshark can decompress with a plugin; or use a library like ws (Node.js) which handles it natively.
- TLS-encrypted WebSocket traffic (wss://) — you can't parse encrypted frames without TLS keys. Capture pre-encryption (Chrome DevTools shows decrypted frames).
- Production runtime monitoring — for that use a library that exposes frame stats, not a manual parser.
Common use cases
- Pre-decision sanity-check on inputs and outputs
- Educational use — demonstrating the underlying concept
- Onboarding a colleague who needs the same calculation/conversion
- Verifying a number or output before passing it on
Frequently asked questions
- Why must client-to-server frames be masked?
- Security. RFC 6455 mandates masking specifically to prevent attacks on infrastructure that proxies WebSocket traffic. Without masking, an attacker who controls partial input bytes (e.g. via cross-origin data) could forge bytes that look like control frames to a transparent proxy, causing it to misinterpret traffic and potentially route data incorrectly. Masking with a random 4-byte key per-frame defeats this. Servers don't need to mask because they aren't the attack target.
- What are the opcodes?
- 0x0 = continuation frame (more of a previous message). 0x1 = text (UTF-8 string). 0x2 = binary. 0x3-0x7 = reserved for non-control. 0x8 = close (with optional code). 0x9 = ping. 0xA = pong. 0xB-0xF = reserved for control. Most app-level traffic is 0x1 or 0x2; control frames (close/ping/pong) handle protocol-level concerns.
- How does the variable payload length work?
- Three encoding levels for compactness: (1) length 0-125: encoded directly in the 7 bits of byte 1; (2) length 126-65535: byte 1 = 126, then 2 bytes for the length; (3) length 65536+: byte 1 = 127, then 8 bytes for the length (max ~9 quintillion). Most messages use level 1; large file uploads use level 2 or 3.
- What's the FIN bit for?
- FIN=1 means this is the last (or only) frame of a message. FIN=0 means more frames will continue this message. This allows splitting one logical message across multiple frames (e.g. a large file you don't want to buffer as one big frame). Most simple use cases have FIN=1 always; only when streaming or sending massive payloads does fragmentation matter.
- Can I capture frames from Chrome DevTools?
- Yes. Open DevTools → Network tab → click your WebSocket connection (look for the WS icon) → click 'Messages' tab. You see decoded text/binary messages, but NOT the raw bytes. To get raw bytes for parsing, use Wireshark on the same network or mitmproxy. For wss:// (TLS), Chrome shows decrypted; Wireshark needs the TLS keys (Chrome's SSLKEYLOGFILE env var enables that).
- What about permessage-deflate compression?
- It's a WebSocket extension (RFC 7692) where each message gets DEFLATE-compressed before framing. The frame structure stays the same; the payload is the compressed version. This parser doesn't auto-decompress. To handle: parse the frame, then DEFLATE-decompress the payload separately if RSV1 is set (per-message-deflate marker).
Advertisement
Learn more
Guides about this topic
- Using Our Tools · GuideHow to generate QR codesMake QR codes for URLs, WiFi, vCard, or text. Learn error correction and sizing, then generate your QR code online free with no sign-up in seconds.
- Using Our Tools · GuideHow to create a strong passwordGenerate a strong password instantly online for free. Build high-entropy passphrases following NIST 2026 rules with no download needed.
- Developers & Technical · GuideHow to encode and decode Base64Understand the 3-to-4 mechanic and 33% overhead for standard, URL-safe, and MIME Base64. Free online reference to avoid common mistakes, no download needed.
- Design & Media · GuideHow to choose a color paletteBuild accessible color palettes using HSL theory, monochromatic to triadic schemes, WCAG contrast checks, and dark mode tips. Free, no-download guide.
- Developers & Technical · GuideHow to use JWT tokens securelyImplement secure JWT authentication by choosing RS256, setting expiration, using httpOnly cookies, and preventing 'alg: none' attacks in your browser for free.
- Design & Media · GuideHow to design a faviconCreate favicons that render perfectly from 16×16 to 512×512 with dark mode support. Learn the right HTML tags and web manifest setup free online.
Explore more developer utilities tools
- Port Number LookupSearch over 140 well-known TCP and UDP ports by number or service name. Free online reference tool with no sign-up, covering web, mail, DNS, and more.
- Test Credit Card NumbersReference table of canonical test card numbers from Stripe, Adyen, and Braintree sandbox docs. Plus Luhn validator + network detector.
- IPv6 Expander & ShortenerFormat IPv6 addresses to canonical form, handling zone IDs and prefixes, instantly online—free tool with no registration required.
- Htpasswd GeneratorCreate .htpasswd lines for Apache or nginx basic auth with browser-only SHA hashing instantly. Includes config snippets and a free online tool with no registration.
- Chmod CalculatorCalculate Unix file permissions: octal (755, 644) ↔ symbolic (rwxr-xr-x) ↔ rwx checkboxes. Covers setuid, setgid, sticky bit. With presets.
- Excel Formula ExplainerPaste any formula and get a plain-English breakdown of 60+ functions online free—no sign-up required, in your browser.