Developer & IT

Free dev toolkit: JSON formatter, Base64 encoder/decoder, JWT decoder, password generator (crypto.getRandomValues), UUID v4, MD5/SHA-256/SHA-512 hash generator, IPv4/CIDR subnet calculator, number base converter, regex tester, cron builder.

⚡ Advanced Tool Available
Full JSON validator, schema builder, JSON Path query & diff viewer
Open JSON Formatter

JSON Formatter & Validator

Validate and pretty-print any JSON payload. 100% client-side — your data never leaves your browser.

Awaiting Input
Keys
Depth
Arrays
Size

Secure Password Generator

Generates cryptographically secure passwords using the Web Crypto API (crypto.getRandomValues). Math.random() is never used.

Password Strength
Strong
~105 bits of entropy
Charset Size
94
Entropy Bits
105

Generated Passwords

IPv4 CIDR Subnet Calculator

Calculate network address, broadcast, usable hosts, subnet mask, and wildcard from any IPv4/CIDR block.

Usable Hosts
254
256 total addresses
FieldValue
Network Address192.168.1.0
Subnet Mask255.255.255.0
Wildcard Mask0.0.0.255
Broadcast Address192.168.1.255
First Usable Host192.168.1.1
Last Usable Host192.168.1.254
Total Addresses256
Usable Hosts254
Host Bits8
IP ClassClass C
CIDR Notation192.168.1.0/24
Expert-Reviewed Developer Reference

The Complete Developer & IT Calculator Reference

Master encoding, cryptography, networking, and data formats — the technical foundations every developer needs to debug faster, build more securely, and understand the systems beneath the code.

01 What Is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 printable ASCII characters: uppercase A-Z (26 chars), lowercase a-z (26 chars), digits 0-9 (10 chars), and the symbols + and / (2 chars), with = used as padding. The name "Base64" directly references this 64-character alphabet.

The encoding algorithm works by processing input data in 3-byte groups (24 bits). Each 24-bit group is split into four 6-bit values, and each 6-bit value is mapped to one Base64 character. This 3-to-4 ratio is why Base64-encoded data is always exactly 33% larger than the original input — a critical consideration when embedding large images in CSS or HTML.

Formula: ceil(input_bytes / 3) × 4 = output_chars. A 300KB PNG becomes 400KB as a Base64 data URI.

When Should You Use Base64?

  • Data URIs: Embedding images directly in HTML/CSS to eliminate HTTP requests — src="data:image/png;base64,iVBORw0K..."
  • JSON APIs: Transmitting binary data (PDF, images, certificates) inside a JSON string field
  • Email (MIME): Encoding binary attachments for email transport (SMTP is text-only)
  • HTTP Basic Auth: Authorization: Basic dXNlcjpwYXNz (Base64 of "user:pass")
Critical Security Note: Base64 is encoding, NOT encryption. Anyone can decode Base64 in milliseconds with any tool. Never use it to "hide" sensitive data in client-side code, cookies, or API responses.

URL-Safe Base64

Standard Base64 uses + and / characters which have special meaning in URLs. URL-safe Base64 (RFC 4648 §5) replaces + with - and / with _, and often omits the = padding. This variant is used in JWT tokens, OAuth tokens, and modern web authentication protocols like WebAuthn.

02 JWT Tokens Explained

JSON Web Tokens (JWT, RFC 7519) are a compact, URL-safe means of representing claims transferring between two parties. A JWT consists of three Base64URL-encoded parts separated by dots: header.payload.signature. Each part can be decoded independently without any secret key.

JWT Structure Deep Dive

  • Header: Contains the token type and signing algorithm: {"alg":"HS256","typ":"JWT"}. Common algorithms: HS256 (HMAC-SHA256), RS256 (RSA), ES256 (ECDSA P-256).
  • Payload: Contains "claims" — statements about the user and additional metadata. Registered claims: iss (issuer), sub (subject/user ID), aud (audience), exp (expiration Unix timestamp), iat (issued-at), jti (JWT ID for blacklisting).
  • Signature: HMACSHA256(base64url(header) + "." + base64url(payload), secret_key). Only verifiable by the party holding the secret.
The Golden Security Rule: Decoding a JWT on the client reveals the data, but provides ZERO security guarantee. You MUST verify the signature on the server before trusting any claims. The "alg:none" attack (CVE-2015-9235) allowed attackers to forge tokens by setting the algorithm to none and omitting the signature.

Algorithm Selection Guide

Symmetric (HS256/384/512)
  • Single secret key for both signing and verification
  • Fast — pure HMAC computation
  • Risk: same secret on all services
  • Best for: single-service auth
Asymmetric (RS256, ES256)
  • Private key signs, public key verifies
  • Any service can verify with public key
  • ES256 smaller + faster than RS256
  • Best for: distributed microservices

Token Storage Best Practices

localStorage is vulnerable to XSS attacks — any injected script can steal the token. HttpOnly cookies prevent JS access but are vulnerable to CSRF. The recommended pattern: store JWT in a HttpOnly; Secure; SameSite=Strict cookie which mitigates both attack vectors when used with CSRF tokens. Access tokens should expire in 15 minutes; refresh tokens in 7-30 days.

03 JSON: The Universal Data Format

JSON (JavaScript Object Notation, RFC 8259) has become the de-facto standard for data interchange on the web. It is a text-based format derived from JavaScript object literal syntax, but language-independent and supported natively in every modern programming language.

JSON Data Types

String
"hello" (double quotes only)
Number
42 or 3.14 (no NaN/Infinity)
Boolean
true / false (lowercase)
Null
null (not undefined)
Array
[1, "two", true]
Object
{"key": "value"}

Common JSON Errors

  • Trailing comma: {"a":1,} — illegal in JSON, valid in JavaScript. The #1 cause of parse errors when hand-writing JSON.
  • Single quotes: {'key': 'value'} — JSON requires double quotes for both keys and string values.
  • Comments: // comment — not valid in JSON. Use JSON5 or strip comments before parsing.
  • Undefined/NaN/Infinity: Not representable in JSON. JSON.stringify(NaN) returns "null".
  • Unquoted keys: {name: "John"} — keys must be quoted strings in JSON.
JSON vs XML size: The same data structure in JSON is typically 30-40% smaller than XML due to the absence of closing tags. JSON parsing is also 3-5x faster in modern V8 engine benchmarks.

JSON Ecosystem Tools

  • JSON5: Superset allowing comments, trailing commas, single quotes — useful for config files
  • NDJSON: Newline-Delimited JSON — one JSON object per line, ideal for streaming and log files
  • JSON Schema: Draft-07/2020-12 — validates JSON structure, types, and constraints
  • JSON Path: $.store.book[0].title — XPath-like query language for JSON
  • JSON Patch (RFC 6902): Standard format for describing changes to a JSON document

04 Cryptographic Hash Functions

A cryptographic hash function takes an arbitrary-length input and produces a fixed-length output (the "digest" or "hash"). A good hash function must satisfy: determinism (same input always produces same output), the avalanche effect (changing one bit flips ~50% of output bits), pre-image resistance (cannot reverse hash to find input), and collision resistance (computationally infeasible to find two inputs with the same hash).

128-bit
MD5 (broken)
160-bit
SHA-1 (deprecated)
256-bit
SHA-256 (current)
512-bit
SHA-512 (highest)

The Hash Function Timeline

  • MD5 (1992): Designed by Ron Rivest. 128-bit output. Full collision attacks demonstrated in 2004 by Xiaoyun Wang. Two different files can now be crafted with the same MD5 hash in seconds on consumer hardware. Do not use for any security purpose. Still used for non-security checksums (Docker image layers, file deduplication).
  • SHA-1 (1995): NSA-designed, 160-bit. The 2017 "SHAttered" attack by Google/CWI demonstrated the first practical SHA-1 collision. Cost: ~$75,000 in cloud compute. Deprecated by all major certificate authorities and browsers since 2017.
  • SHA-256 (2001): Part of the SHA-2 family designed by NSA. 256-bit output. Used in: TLS 1.3 certificates, Bitcoin proof-of-work, AWS S3 ETags, code signing (Authenticode, APK), and most modern security protocols.
  • SHA-512 (2001): Also SHA-2 family. 512-bit output. Counter-intuitively, SHA-512 is faster than SHA-256 on 64-bit processors because it uses 64-bit word operations internally, while SHA-256 uses 32-bit operations requiring more rounds.
  • SHA-3 / Keccak (2015): Fundamentally different "sponge" construction versus SHA-2's Merkle-Damgård. Quantum-resistant. Not yet widely deployed but standardized by NIST as a parallel option to SHA-2.
⚠ Password Hashing Warning: NEVER store passwords as plain MD5, SHA-1, or even SHA-256. Attackers use rainbow tables and GPUs doing billions of hashes/second. Always use purpose-built password hashing algorithms with salts: bcrypt (cost factor ≥10), Argon2id (recommended by OWASP 2023), or PBKDF2 with SHA-256 and 600,000+ iterations (NIST SP 800-132).

05 Secure Password Generation

Password security is fundamentally an entropy problem. Entropy — measured in bits — quantifies how unpredictable a password is. The formula is straightforward: entropy = length × log₂(charset_size). The higher the entropy, the longer a brute-force attack takes.

Entropy Formula: With a 94-character set (uppercase + lowercase + digits + 32 symbols):
• 12 chars: 12 × log₂(94) = 12 × 6.55 = 78.8 bits (Good)
• 16 chars: 16 × 6.55 = 104.9 bits (Very Strong)
• 20 chars: 20 × 6.55 = 131.1 bits (Practically uncrackable)

Why Math.random() Is Dangerous

Math.random() in JavaScript uses a pseudo-random number generator (PRNG) — specifically the xorshift128+ algorithm in V8. It is seeded and deterministic: if an attacker can observe several values from Math.random(), they can reconstruct the seed and predict all future values. This is a well-documented attack against weak random number generators.

The correct approach is crypto.getRandomValues(new Uint32Array(length)) which calls the operating system's CSPRNG (Cryptographically Secure Pseudo-Random Number Generator): /dev/urandom on Linux, CryptGenRandom on Windows. These sources use hardware entropy (CPU timing jitter, hardware random number generators on modern CPUs).

Strength Benchmarks (at 1 trillion guesses/second)

Weak (under 60 bits)
  • 8-char lowercase only: 37.6 bits — cracked in <1 second
  • 8-char mixed case: 45.6 bits — hours
  • Common dictionary words — seconds
Strong (80+ bits)
  • 12-char full charset: 78.8 bits — centuries
  • 16-char full charset: 105 bits — heat death of universe
  • 20-char full charset: 131 bits — beyond computational limits

06 UUID: Universally Unique Identifiers

UUIDs (RFC 4122 / RFC 9562) are 128-bit identifiers formatted as 32 hexadecimal characters in five groups separated by hyphens: xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx. The M digit indicates version and N indicates variant.

UUID Versions Compared

  • v1 (Time + MAC): Encodes timestamp and network MAC address. Sortable but leaks the generating machine's MAC address — a privacy risk that led to v4.
  • v3 (MD5 Name-based): Deterministic UUID from a namespace + name using MD5. Same inputs always produce the same UUID.
  • v4 (Random): 122 bits of randomness. The most widely used variant. crypto.randomUUID() in modern browsers.
  • v5 (SHA-1 Name-based): Same as v3 but using SHA-1. Preferred over v3.
  • v7 (RFC 9562, 2024): Time-ordered monotonically increasing UUID. First 48 bits = Unix timestamp milliseconds. Dramatically better for database primary keys as they maintain B-tree locality (no page splits like random v4).
Collision Probability: With v4 UUIDs, after generating 1 billion UUIDs, the probability of a single collision is approximately 1.7×10⁻¹⁰. For practical purposes: if you generate 1 UUID per millisecond, you would need 85 years before having a 50% chance of a single collision.

ULID — The Modern Alternative

ULID (Universally Unique Lexicographically Sortable Identifier) offers 26-character Base32 encoding, millisecond timestamp precision, and URL-safe output — with no hyphens. Like UUID v7, it is monotonically sortable. Format: 01ARZ3NDEKTSV4RRFFQ69G5FAV. Increasingly preferred for modern distributed systems.

07 IPv4 Subnetting & CIDR

IPv4 addresses are 32-bit numbers, typically written in dotted-decimal notation (e.g. 192.168.1.0). CIDR (Classless Inter-Domain Routing, RFC 4632, 1993) replaced the original classful addressing system and enabled efficient allocation of IP space by allowing arbitrary prefix lengths.

IPv4 Address Classes (Historical)

  • Class A (/8): 1.0.0.0 – 126.255.255.255 — 16.7 million hosts per network. 127.x.x.x reserved for loopback.
  • Class B (/16): 128.0.0.0 – 191.255.255.255 — 65,534 hosts per network
  • Class C (/24): 192.0.0.0 – 223.255.255.255 — 254 hosts per network
  • Class D: 224.0.0.0 – 239.255.255.255 — Multicast

Private Address Ranges (RFC 1918)

  • 10.0.0.0/8 — 16,777,214 usable hosts (large enterprises)
  • 172.16.0.0/12 — 1,048,574 usable hosts (medium networks)
  • 192.168.0.0/16 — 65,534 usable hosts (home/small office)
  • 169.254.0.0/16 — APIPA (Automatic Private IP Addressing, link-local)
  • 127.0.0.0/8 — Loopback (only 127.0.0.1 is commonly used)

Subnet Math Reference

CIDRSubnet MaskHostsUse Case
/8255.0.0.016,777,214Large ISP / Enterprise
/16255.255.0.065,534Campus Network
/24255.255.255.0254Standard LAN segment
/25255.255.255.128126VLAN split
/26255.255.255.19262Department subnet
/27255.255.255.22430Small segment
/28255.255.255.24014DMZ / Server farm
/30255.255.255.2522Point-to-point link
/31255.255.255.2542 (no subtract)Router interface (RFC 3021)
/32255.255.255.2551Host route / Loopback

08 Binary, Octal, Decimal, and Hexadecimal

Computers operate exclusively in binary (base-2) at the hardware level. Higher-level number systems like decimal (base-10) and hexadecimal (base-16) are abstractions for human convenience. Understanding all four systems is fundamental to low-level programming, networking, permissions, and debugging.

Why Hexadecimal?

Hexadecimal is so pervasive in computing because each hex digit exactly represents 4 binary bits (a "nibble"). This means one byte (8 bits) is always exactly 2 hex digits. FF hex = 11111111 binary = 255 decimal. Memory addresses, color codes (#FF5733), MAC addresses (00:1A:2B:3C:4D:5E), and error codes all use hex for this compact, unambiguous representation.

Bitwise Operations

  • AND (&): 1 only if both bits are 1. Used for masking: ip & mask gives the network address
  • OR (|): 1 if either bit is 1. Used to set bits: permissions | 0x04
  • XOR (^): 1 if bits differ. Used for toggling and simple encryption
  • NOT (~): Inverts all bits. ~mask gives the wildcard mask in subnet calculations
  • Left Shift (<<): Multiplies by 2^n. 1 << 8 = 256
  • Right Shift (>>): Divides by 2^n. Used for extracting octets from an IP integer

Unix File Permissions (Octal)

Unix chmod permissions are expressed in octal. Each permission digit (0-7) encodes read (4), write (2), execute (1) in 3 bits. chmod 755 = owner: rwx (7=111), group: r-x (5=101), others: r-x (5=101). chmod 644 = owner: rw- (6=110), group: r-- (4=100), others: r-- (4=100). Understanding this requires knowing octal-to-binary conversion.

09 URL Encoding vs Base64

Both URL encoding and Base64 convert data to safe ASCII representations, but for fundamentally different purposes and contexts. Confusing the two is a common source of bugs.

URL Encoding (Percent Encoding)
  • Purpose: make text safe for use IN URLs
  • Size: compact (1-9 chars per byte)
  • ASCII stays readable: "hello" = "hello"
  • Space → %20 (or + in forms)
  • @ → %40, / → %2F, = → %3D
  • Use: query params, form data, path segments
Base64 Encoding
  • Purpose: embed binary data in text formats
  • Size: always +33% larger than input
  • All output looks like random text
  • Use: images in JSON/CSS, email attachments
  • Not suitable for URLs (use URL-safe variant)
  • Never double-encode

JavaScript Encoding Functions

  • encodeURIComponent() — encodes everything except A-Z a-z 0-9 - _ . ! ~ * ' ( ). Use for query parameter values.
  • encodeURI() — preserves URI structure characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =). Use for complete URLs.
  • btoa() / atob() — Base64 encode/decode. Fails on characters outside Latin-1. Use TextEncoder for Unicode.

10 Regular Expressions

Regular expressions (regex) are a domain-specific language for describing text patterns. They are implemented in virtually every programming language and are an essential tool for data validation, text transformation, and parsing. The syntax originates from formal language theory, specifically the theory of regular languages.

Core Regex Components

  • Literals: Match exactly — cat matches the string "cat"
  • Character classes: [aeiou] matches any vowel. [^aeiou] matches any non-vowel. . matches any character (except newline by default)
  • Shorthand classes: \d (digit), \w (word char: [a-zA-Z0-9_]), \s (whitespace), and their uppercase negations \D, \W, \S
  • Quantifiers: * (0 or more), + (1 or more), ? (0 or 1), {n} (exactly n), {n,m} (n to m). Add ? after for lazy/non-greedy: +?
  • Anchors: ^ (start of string/line), $ (end), \b (word boundary), \B (non-word boundary)
  • Groups: (pattern) capturing group, (?:pattern) non-capturing, (?P<name>pattern) named group
⚠ ReDoS (Regular Expression Denial of Service): Patterns like (a+)+ exhibit catastrophic backtracking on non-matching input, causing O(2^n) time complexity. Never apply user-supplied regex to large strings without a timeout. The Cloudflare outage of July 2019 was caused by a ReDoS attack on a WAF regex rule.

11 Cron Job Scheduling

Cron is a time-based job scheduler originating in Unix (AT&T Bell Labs, circa 1979). The name derives from Chronos, the Greek god of time. It remains the most widely used scheduling mechanism for server-side task automation, running from simple database backups to complex ETL pipelines.

Field Reference

PositionFieldRangeSpecial Chars
1stMinute0-59* , - /
2ndHour0-23* , - /
3rdDay of Month1-31* , - / ? L W
4thMonth1-12 or JAN-DEC* , - /
5thDay of Week0-7 (0,7=Sunday)* , - / ? L #

Common Patterns

  • */5 * * * * — Every 5 minutes
  • 0 2 * * * — 2:00 AM daily (e.g. database backup)
  • 0 9 * * 1-5 — 9:00 AM Monday–Friday (business hours jobs)
  • 0 0 1 * * — Midnight on the 1st of every month (monthly reports)
  • 0 */6 * * * — Every 6 hours (health checks)
  • 30 23 * * 5 — 11:30 PM every Friday (weekly maintenance)
Cloud Equivalents: AWS EventBridge Scheduler, GCP Cloud Scheduler, Azure Logic Apps, and GitHub Actions (on: schedule:) all use cron syntax. Always specify the timezone in cloud environments — default is usually UTC.

12 The Web Crypto API

The Web Cryptography API (window.crypto.subtle) is a browser-native cryptographic interface providing access to common cryptographic operations without any external library. It is available in all modern browsers (Chrome 37+, Firefox 34+, Safari 11+) and Node.js 15+. All operations are Promise-based and asynchronous, and the implementation is typically FIPS 140-2 compliant.

Key Capabilities

  • Hashing: SHA-1, SHA-256, SHA-384, SHA-512 via crypto.subtle.digest()
  • HMAC: Message authentication with SHA-256/512
  • AES-GCM: Authenticated symmetric encryption (256-bit key)
  • RSA-OAEP: Asymmetric encryption
  • ECDH: Elliptic-curve Diffie-Hellman key exchange
  • ECDSA: Digital signatures (P-256, P-384, P-521)
  • PBKDF2 / HKDF: Key derivation functions
True Randomness: crypto.getRandomValues() accesses the operating system's CSPRNG — /dev/urandom on Linux/macOS, BCryptGenRandom on Windows. Unlike Math.random(), this source is seeded from hardware entropy (CPU jitter, hardware RNG, OS entropy pool) and is suitable for cryptographic use.

13 Developer Security Best Practices

The OWASP Top 10 2021 identifies the most critical web application security risks. Three dominate developer-caused vulnerabilities:

  • A01 — Broken Access Control: 94% of applications had some form of broken access control. Always enforce permissions server-side. Never rely on hiding UI elements.
  • A02 — Cryptographic Failures: Formerly "Sensitive Data Exposure". Using MD5/SHA-1 for passwords, transmitting data over HTTP, storing secrets in source code.
  • A03 — Injection: SQL injection, command injection, XSS. Always use parameterized queries. Never concatenate user input into queries or HTML.

Essential Security Headers

  • Content-Security-Policy: Prevents XSS by allowlisting trusted script/style sources
  • X-Content-Type-Options: nosniff — Prevents MIME-type sniffing attacks
  • Strict-Transport-Security: max-age=31536000; includeSubDomains — Enforces HTTPS for 1 year
  • X-Frame-Options: DENY — Prevents clickjacking via iframes
  • Permissions-Policy: Restricts access to browser APIs (camera, microphone, geolocation)

Secrets Management

  • Never hardcode secrets in source code (API keys, passwords, tokens). Use environment variables.
  • Rotate secrets regularly. Assume any secret that touches a developer machine is compromised.
  • Use secret managers: AWS Secrets Manager, HashiCorp Vault, Azure Key Vault, GCP Secret Manager.
  • Scan commits for secrets: git-secrets, GitGuardian, Trufflehog. Every public GitHub repo is scanned by bots within minutes of a push.
Subresource Integrity (SRI): When loading scripts from CDNs, always add the integrity attribute: <script integrity="sha384-abc123...">. This prevents a compromised CDN from serving malicious JavaScript. All major CDN libraries provide SRI hashes.

14 Frequently Asked Questions

What is Base64 encoding and when should I use it?
Base64 converts binary data to ASCII text using 64 printable characters (A-Z, a-z, 0-9, +, /). Encoding groups 3 bytes (24 bits) into 4 Base64 chars (6 bits each), causing a 33% size increase. Use cases: embedding images in CSS/HTML as data URIs (data:image/png;base64,...), encoding binary data for JSON APIs, HTTP Basic Auth headers (username:password). Important: Base64 is NOT encryption and is trivially reversible. URL-safe Base64 replaces + with - and / with _.
How do I decode a JWT token without a library?
JWT = header.payload.signature (three Base64URL segments separated by dots). Decode each with: atob(segment.replace(/-/g,'+').replace(/_/g,'/')). Payload claims: sub (subject), iat (issued-at Unix timestamp), exp (expiry Unix timestamp), iss (issuer). Critical security rule: never trust client-decoded JWT for authorization. Always verify the signature server-side with the secret key. This decoder is for debugging and inspection only.
How does IPv4 CIDR subnet notation work?
CIDR notation: IP address / prefix length (e.g. 192.168.1.0/24). Prefix defines how many bits are the network portion. Formula: usable hosts = 2^(32-prefix) - 2 (subtract network address and broadcast). /24 = 255.255.255.0 mask = 256 total, 254 usable. Common: /8=16M hosts, /16=65,534 hosts, /24=254 hosts, /30=2 hosts (point-to-point). /31 per RFC 3021 has 2 hosts with no subtraction.
What is the difference between MD5, SHA-1, SHA-256, and SHA-512?
MD5 (128-bit, 1992): broken since 2004, collision attacks trivial. Do not use for security. SHA-1 (160-bit, 1995): collision attack demonstrated in 2017 (SHAttered, cost $75K). Deprecated for TLS/certificates. SHA-256 (256-bit): current security standard used in TLS 1.3, Bitcoin, code signing. SHA-512 (512-bit): faster than SHA-256 on 64-bit CPUs due to 64-bit word operations. For passwords: never plain hash. Use bcrypt (cost 10+), Argon2id, or PBKDF2 with 600K+ iterations (NIST 2023).
How do I generate a cryptographically secure password?
Use crypto.getRandomValues() (Web Crypto API), never Math.random() which is a seeded PRNG and NOT cryptographically secure. Entropy formula: bits = length x log2(charset_size). With 94-char set (all types): 12 chars=78.8 bits (Good), 16 chars=105 bits (Very Strong), 20 chars=131 bits (practically uncrackable by brute force). NIST SP 800-63B recommends minimum 8 chars, recommends 16+ for sensitive accounts.
What is UUID v4 and how is it generated?
UUID v4 is randomly generated: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx where 4=version, y=variant (8,9,a,b). Contains 122 bits of randomness. Collision probability with 1 billion UUIDs: approximately 1.7x10^-10 (negligible). In JavaScript: crypto.randomUUID() in modern browsers. For database primary keys prefer UUID v7 (RFC 9562, 2024, time-ordered) or ULID to avoid B-tree page splits caused by random insertion order.
How do I validate and format a JSON payload programmatically?
JSON.parse() throws SyntaxError on invalid JSON. Common errors: trailing commas (valid in JS, fatal in JSON), single quotes (JSON requires double quotes), unquoted keys, undefined/NaN/Infinity (not valid JSON). Format with JSON.stringify(parsed, null, 2) for 2-space indent. JSON5 superset allows comments and trailing commas. JSON Schema (Draft-07/2020-12) validates structure, types, and constraints against a schema definition.
What regex validates email addresses?
Practical pattern: /^[a-zA-Z0-9.!#%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*/. RFC 5322 allows many unusual local-part characters. Common mistakes: rejecting + in local part (Gmail uses this for aliases like user+filter@gmail.com), rejecting uncommon TLDs (.museum, .photography), not allowing internationalized domain names (IDN). The only true email validation is sending a confirmation email to it.
How do I read and parse a cron expression?
Cron format: minute(0-59) hour(0-23) day-of-month(1-31) month(1-12) day-of-week(0-7). Special chars: *(any), ,(list: 1,3,5), -(range: 1-5), /(step: */5 means every 5). Examples: 0 2 * * *=2AM daily. */5 * * * *=every 5 minutes. 0 9 * * 1-5=9AM on weekdays only. @daily, @weekly, @monthly shorthand strings are supported by most cron implementations. Both 0 and 7 equal Sunday for day-of-week.
What is the difference between binary, octal, decimal, and hexadecimal?
Number systems by radix (base). Decimal (base-10): digits 0-9, human default. Binary (base-2): digits 0-1, maps directly to CPU transistor states (off/on), 8 bits=1 byte (0-255). Octal (base-8): digits 0-7, used in Unix chmod permissions (755=rwxr-xr-x=111 101 101 in binary). Hex (base-16): digits 0-9 plus A-F, 1 hex digit=4 bits (1 nibble), 2 hex digits=1 byte. 255 decimal=11111111 binary=377 octal=FF hex.
How does URL percent encoding work?
RFC 3986: reserved URL characters encoded as %XX where XX is the UTF-8 byte in hexadecimal. Space=%20 (or + in form-encoded data), @=%40, /=%2F, ==%3D. encodeURIComponent() in JavaScript encodes everything except A-Z a-z 0-9 - _ . ! ~ * ' ( ). encodeURI() preserves URI structure characters. Never double-encode data (encoding already-encoded strings breaks URLs). For form submissions: application/x-www-form-urlencoded uses + for space, not %20.
What is the subnet broadcast address and how is it calculated?
Broadcast = Network address OR (bitwise NOT of subnet mask). For /24: network=x.x.x.0, broadcast=x.x.x.255. For /28 (mask 255.255.255.240): host bits=4, block size=16, broadcast=network address+15. Broadcast delivers a single packet to ALL hosts on the subnet simultaneously. Never assign the broadcast address as a host IP. First usable host=network+1, last usable host=broadcast-1. Usable formula: 2^(host_bits) - 2.
How do regex lookahead and lookbehind assertions work?
Lookahead (?=pattern): matches position followed by pattern. /\w+(?=\s+cat)/ matches 'fat' in 'fat cat'. Negative lookahead (?!pattern): /\d+(?!px)/ matches numbers not followed by px. Lookbehind (?<=pattern): /(?<=\)\d+/ matches '100' in '100'. Negative lookbehind (?
What is the difference between URL encoding and Base64 encoding?
Purpose is fundamentally different. URL encoding (percent-encoding) makes arbitrary text safe for use inside URLs — compact, preserves readable ASCII text. Base64 converts binary data to printable ASCII for embedding inside text formats (JSON, XML, CSS, email MIME). Base64 output is always 33% larger than source. URL encoding varies (1-9 chars per byte). Never use Base64 for URL query parameters (use encodeURIComponent instead). Never double-encode data as it creates corrupted strings.
How many usable hosts are in a subnet?
Formula: usable hosts = 2^(32 - prefix_length) - 2. Subtract 2 because: first address = network address (identifies the subnet, cannot be assigned to a host), last address = broadcast address (delivers to all hosts, cannot be assigned). Exception: /31 subnets (RFC 3021) have 2 total addresses and 0 subtracted — used for point-to-point router links. /32 = single host route or loopback. Quick reference: /24=254, /25=126, /26=62, /27=30, /28=14, /29=6, /30=2 usable hosts.

Rate Developer & IT

Help us improve by rating this tool.

4.9/5
807 reviews