📡

Server-Sent Events (SSE) Formatter — Build and Debug Real-Time Streams

Build Server-Sent Events messages with id, event, data, retry, and comment fields for testing SSE endpoints. Fill in each field individually and instantly see the correctly formatted SSE message string with double-newline terminator. Supports multi-line data fields, keep-alive comment lines, and an escaped wire-format view. Five presets cover the most common SSE patterns. Free and runs entirely in your browser.

API ToolsAPI & Backend
Loading tool...

How to Use Server-Sent Events (SSE) Formatter — Build and Debug Real-Time Streams

How to Use the SSE Event Formatter:

  1. Load a Preset (Optional): Click any preset button at the top to pre-fill all fields with a real-world SSE pattern. Simple loads a plain data-only event. Named Event shows a typed JSON event with an id. Multi-line demonstrates streaming chunks as separate data fields. With Retry sets a custom reconnection delay. Heartbeat shows a keep-alive comment-only message. Each preset can be edited after loading.

  2. Enter a Comment (Optional): The comment field renders as a line starting with : (colon-space). Per the SSE specification, comment lines are completely ignored by the browser's EventSource client and are used to keep the connection alive during idle periods. Type any text — "ping", "keep-alive", or server metadata — and it will appear as : your text in the formatted output.

  3. Enter an Event ID (Optional): The id field sets the event identifier. The browser stores this value and sends it as a Last-Event-ID header on reconnection, allowing the server to resume the stream from the correct position after a disconnect. Use sequential integers, UUIDs, or timestamps as appropriate for your stream design.

  4. Enter an Event Type (Optional): The event field sets the event type name. If omitted, the browser dispatches the event as a generic "message" event and your addEventListener("message", handler) will receive it. If set, use a named event listener — addEventListener("update", handler) for event: update. Event type names should not contain whitespace.

  5. Enter the Data Payload: The data textarea is the main content of the event. For JSON payloads, paste the serialised JSON on a single line. For multi-line streaming responses, press Enter to add a new line — each line in the textarea becomes a separate data: field in the formatted output. The browser concatenates multiple data fields with a newline when constructing the event data property.

  6. Enter a Retry Value (Optional): The retry field tells the browser how many milliseconds to wait before attempting to reconnect after the stream drops. Enter a non-negative integer only — decimals and negative values are not valid per the SSE specification. A common value is 3000 (3 seconds). If omitted, the browser uses its default reconnection interval (typically a few seconds).

  7. Read the Stats Row: Three metrics update instantly above the output: Fields (number of active SSE fields in the message), Data lines (how many data: lines were generated from the data textarea), and Bytes (the total byte size of the formatted message including the terminating blank line).

  8. Switch Between Formatted and Escaped Views: The Formatted view shows the message exactly as it would appear on the wire, with real line breaks and a trailing blank line. The Escaped view shows the literal \n characters — useful for constructing the string in code (e.g., when writing a Python/Node.js SSE endpoint that builds the response string manually).

  9. Copy the Message: Click Copy to copy the formatted SSE message string (with actual newlines) to your clipboard. Use it in curl to test an SSE endpoint, in Postman's response body, or directly in server-side code. The copied text always includes the double-newline terminator required by the SSE specification.

  10. Test Your Endpoint: Paste the formatted message into a tool like curl or Postman to simulate an SSE response. A valid SSE response requires Content-Type: text/event-stream and Transfer-Encoding: chunked or HTTP/2 streaming. Each event in the stream must end with a blank line (\n\n).

Common Use Cases:

  • SSE endpoint development: Format test events to verify your EventSource client parses id, event, data, and retry fields correctly before integrating with a live stream.
  • Streaming LLM responses: Build multi-line data messages that simulate chunked text from an AI model to test your frontend streaming UI.
  • Real-time notification systems: Construct named events (event: notification) with JSON payloads to test browser-side event listeners.
  • Keep-alive debugging: Generate heartbeat comment messages (: ping) to verify that your SSE middleware does not drop idle connections.
  • Reconnection testing: Set a retry field to test that your client respects the server-specified reconnection delay rather than using the browser default.
  • SSE proxy testing: Format edge-case messages (empty data, multi-line data, missing fields) to verify your SSE proxy or middleware handles all valid SSE shapes correctly.
  • Documentation and spec verification: Use the escaped view to confirm the exact byte sequence of a message when writing SSE protocol documentation.

Tips and Best Practices:

  • Every valid SSE message must end with a blank line (\n\n). The formatter adds this automatically — do not add it manually in the data field.
  • JSON payloads must be on a single line when used as SSE data. Newlines inside JSON would create multiple data: fields, and the browser would concatenate them with \n, producing broken JSON.
  • Use the Multi-line preset to see how streaming token-by-token responses work — each token on a new textarea line becomes a separate data: field.
  • The id field is optional but strongly recommended for any stream that clients may reconnect to. Without it, the browser cannot resume the stream after a network drop.
  • Comments (: lines) are useful for keep-alive pings but generate zero data on the client side. Do not rely on them to carry information.
  • The retry value is a hint to the browser, not a guarantee — some browsers cap the minimum reconnection delay regardless of the retry field.
  • Use named events (event: type) to fan out different event types over a single SSE connection, with separate addEventListener calls on the client.
  • Switch to the Escaped view when writing server code to see the exact string your endpoint must produce: fields joined by \n and terminated by \n\n.

Frequently Asked Questions

Most Viewed Tools

📺

Screen Size Converter — Diagonal Dimension Tool

6,003 views

Calculate screen width and height from diagonal size and aspect ratio. Convert between inches and centimeters for displays, TVs, and monitors with instant dimension calculations.

Use Tool →
🖨️

DPI Calculator — Print Resolution Tool

3,914 views

Calculate DPI (dots per inch), image dimensions, and print sizes. Convert between pixels and physical dimensions for printing and displays.

Use Tool →
🔐

TOTP Code Generator — 2FA Testing Tool

3,616 views

Generate time-based one-time passwords from a TOTP secret key. Enter your base32 secret, choose a period and digit length, and get the current and next codes with a live countdown timer. Useful for testing and debugging 2FA integrations.

Use Tool →
{}

JSONL Formatter — Line-by-Line Validator

3,613 views

Format, validate, and inspect JSON Lines (JSONL) and NDJSON files. Validates each line individually, reports parse errors by line number, outputs compact JSONL or a pretty-print preview, and lets you download the cleaned file.

Use Tool →
{ }

JSON to Zod — Schema Generator

3,497 views

Generate Zod validation schema code from a JSON sample object. Infers z.string(), z.number(), z.boolean(), z.array(), z.object(), and z.null() types automatically. Handles nested objects, arrays of objects with optional field detection, and outputs copy-ready TypeScript with import and z.infer type alias.

Use Tool →
🔑

Password Entropy Calculator — Crack Time Estimator

3,298 views

Calculate the information-theoretic bit entropy of any password or API key. Detects character set pools automatically, shows the total number of possible combinations, and estimates crack time across five attack scenarios from rate-limited web logins to GPU cracking clusters.

Use Tool →
🔐

TLS Cipher Suite Checker — Strength Analyzer

3,286 views

Check TLS protocol version compatibility and cipher suite strength ratings against current best practices. Supports IANA and OpenSSL cipher names — rates each suite as Strong, Weak, or Deprecated and explains why.

Use Tool →
🔍

Secret Scanner — API Key & Credential Detector

3,021 views

Scan pasted text, code, or config files for accidentally exposed API keys, tokens, passwords, and private keys. Detects 50+ secret types across AWS, GitHub, Stripe, OpenAI, and more — all client-side, nothing leaves your browser.

Use Tool →

Related API & Backend Tools

🔌

API Tester — In-Browser REST Client

Test HTTP API endpoints directly in your browser. Make GET, POST, PUT, PATCH, and DELETE requests with custom headers and request bodies. View status codes, response headers, and pretty-printed JSON responses — all client-side, no server proxy.

Use Tool →

GraphQL Subscription Builder — Generate WebSocket Payloads and Client Queries

Build GraphQL subscription query strings and generate WebSocket connection code snippets for Apollo Client, urql, and graphql-ws. Define your operation name, variables, and selection fields visually, then copy the ready-to-use code.

Use Tool →
🔍

API Error Decoder — Fix Suggestion Tool

Decode HTTP status codes and OAuth 2.0 error strings with plain-English descriptions, common causes, and actionable fix suggestions. Covers every HTTP 1xx–5xx status code and all standard OAuth 2.0 error responses. Results appear instantly as you type.

Use Tool →
📊

GraphQL Cost Estimator — Analyze Query Complexity and Depth

Assign custom field weights to a GraphQL schema and calculate the total query complexity score. Paste any GraphQL query, configure per-field costs, and get a per-field breakdown table showing depth, multipliers, and cumulative cost.

Use Tool →
⏱️

API Latency Budget Calculator — Plan Distributed System Performance

Set a P99 SLO latency target and distribute the budget across your upstream service dependencies. See remaining headroom, utilization percentage, a stacked allocation bar, and a per-service breakdown with optional P99 actual measurements.

Use Tool →
📝

REST Endpoint Documenter — Markdown Doc Generator

Document a REST endpoint quickly by entering the URL, method, headers, and sample request/response. Generates formatted Markdown documentation and an example cURL command instantly.

Use Tool →
🗄️

HTTP Cache Header Generator — Optimize Browser & CDN Caching

Generate Cache-Control, Vary, and ETag headers for web and API responses. Select a caching strategy (public, private, no-cache, no-store), set browser and CDN TTLs, and configure advanced directives like stale-while-revalidate. Outputs ready-to-use snippets for nginx, Express.js, and Apache.

Use Tool →
🔄

HTTP Retry Policy Builder — Configure Resilient API Client Logic

Configure max retries, initial delay, backoff multiplier, jitter, max delay cap, and retryable HTTP status codes to instantly generate ready-to-use retry policy code for Axios (with axios-retry), native Fetch API (Node 18+ and node-fetch), and Go net/http. Supports presets for Standard, Aggressive, Conservative, and Rate-Limit Aware policies. All code is generated in your browser — free, instant, no signup.

Use Tool →

Share Your Feedback

Help us improve this tool by sharing your experience

We will only use this to follow up on your feedback